You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vxquery.apache.org by pr...@apache.org on 2014/04/02 06:11:49 UTC
[09/50] [abbrv] git commit: Added support for unnest in expression
toolbox sequence matching.
Added support for unnest in expression toolbox sequence matching.
Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/735140b0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/735140b0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/735140b0
Branch: refs/heads/prestonc/hash_join
Commit: 735140b058d7f4dcc35595ba21c0bd164ea6b225
Parents: 9f14f92
Author: Preston Carman <pr...@apache.org>
Authored: Tue Mar 4 17:27:21 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Tue Apr 1 20:56:23 2014 -0700
----------------------------------------------------------------------
...stractRemoveRedundantTypeExpressionsRule.java | 3 ++-
.../rewriter/rules/util/ExpressionToolbox.java | 19 ++++++++++++-------
2 files changed, 14 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/735140b0/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractRemoveRedundantTypeExpressionsRule.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractRemoveRedundantTypeExpressionsRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractRemoveRedundantTypeExpressionsRule.java
index 5298f2a..5d83be7 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractRemoveRedundantTypeExpressionsRule.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractRemoveRedundantTypeExpressionsRule.java
@@ -63,6 +63,7 @@ public abstract class AbstractRemoveRedundantTypeExpressionsRule implements IAlg
private boolean processTypeExpression(Mutable<ILogicalOperator> opRef, Mutable<ILogicalExpression> search) {
boolean modified = false;
SequenceType inputSequenceType;
+ SequenceType sTypeArg;
functionList.clear();
ExpressionToolbox.findAllFunctionExpressions(search, getSearchFunction(), functionList);
for (Mutable<ILogicalExpression> searchM : functionList) {
@@ -74,7 +75,7 @@ public abstract class AbstractRemoveRedundantTypeExpressionsRule implements IAlg
inputSequenceType = ExpressionToolbox.getOutputSequenceType(opRef, argFirstM, dCtx);
// Find the argument type.
- SequenceType sTypeArg = null;
+ sTypeArg = null;
if (hasTypeArgument()) {
sTypeArg = ExpressionToolbox.getTypeExpressionTypeArgument(searchM, dCtx);
}
http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/735140b0/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/ExpressionToolbox.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/ExpressionToolbox.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/ExpressionToolbox.java
index 7794ed0..dc9e0d3 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/ExpressionToolbox.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/ExpressionToolbox.java
@@ -20,7 +20,6 @@ import java.util.List;
import org.apache.commons.lang3.mutable.Mutable;
import org.apache.vxquery.compiler.algebricks.VXQueryConstantValue;
-import org.apache.vxquery.context.RootStaticContextImpl;
import org.apache.vxquery.context.StaticContextImpl;
import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
import org.apache.vxquery.functions.BuiltinFunctions;
@@ -33,13 +32,13 @@ import org.apache.vxquery.types.SequenceType;
import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalOperator;
import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalExpressionTag;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalOperatorTag;
import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ConstantExpression;
import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator;
+import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.UnnestOperator;
import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
public class ExpressionToolbox {
@@ -171,8 +170,7 @@ public class ExpressionToolbox {
return pTypeCode.getInteger();
}
- public static SequenceType getTypeExpressionTypeArgument(Mutable<ILogicalExpression> searchM,
- StaticContextImpl dCtx) {
+ public static SequenceType getTypeExpressionTypeArgument(Mutable<ILogicalExpression> searchM, StaticContextImpl dCtx) {
int typeId = getTypeExpressionTypeArgument(searchM);
if (typeId > 0) {
return dCtx.lookupSequenceType(typeId);
@@ -209,10 +207,17 @@ public class ExpressionToolbox {
return null;
}
AbstractLogicalOperator variableOp = (AbstractLogicalOperator) variableProducer.getValue();
- if (variableOp.getOperatorTag() == LogicalOperatorTag.DATASOURCESCAN) {
- return SequenceType.create(AnyNodeType.INSTANCE, Quantifier.QUANT_ONE);
+ switch (variableOp.getOperatorTag()) {
+ case DATASOURCESCAN:
+ return SequenceType.create(AnyNodeType.INSTANCE, Quantifier.QUANT_ONE);
+ case UNNEST:
+ UnnestOperator unnest = (UnnestOperator) variableOp;
+ return getOutputSequenceType(variableProducer, unnest.getExpressionRef(), dCtx);
+ default:
+ // TODO Consider support for other operators. i.e. Assign.
+ break;
}
- // TODO Consider support for other operators. i.e. Assign.
+
}
return null;
}