A bunch of little clean up items.
Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/de02fe56 Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/de02fe56 Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/de02fe56 Branch: refs/heads/master Commit: de02fe56218a6d4debdb00018c354008da2b64b3 Parents: e6b5ac2 Author: Preston Carman <[email protected]> Authored: Thu Feb 13 11:11:20 2014 -0800 Committer: Preston Carman <[email protected]> Committed: Thu Feb 13 11:11:20 2014 -0800 ---------------------------------------------------------------------- .../algebricks/VXQueryBinaryBooleanInspectorFactory.java | 2 +- .../algebricks/VXQueryBinaryIntegerInspectorFactory.java | 2 +- .../compiler/algebricks/VXQueryComparatorFactoryProvider.java | 4 ++-- .../rewriter/rules/EliminateSubplanForSingleItemsRule.java | 2 +- .../rewriter/rules/RemoveUnusedSortDistinctNodesRule.java | 3 --- .../vxquery/compiler/rewriter/rules/RemoveUnusedTreatRule.java | 4 ++-- .../compiler/rewriter/rules/SetCollectionDataSourceRule.java | 5 +++++ .../compiler/rewriter/rules/SetVariableIdContextRule.java | 4 ++++ .../functions/aggregate/FnAvgScalarEvaluatorFactory.java | 5 +---- .../base/AbstractTaggedValueArgumentAggregateEvaluator.java | 2 +- .../base/AbstractTaggedValueArgumentScalarEvaluator.java | 2 +- .../base/AbstractTaggedValueArgumentUnnestingEvaluator.java | 2 +- .../functions/step/AttributePathStepScalarEvaluator.java | 4 +--- 13 files changed, 21 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/de02fe56/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryBooleanInspectorFactory.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryBooleanInspectorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryBooleanInspectorFactory.java index 4e92f87..afb4d58 100644 --- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryBooleanInspectorFactory.java +++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryBooleanInspectorFactory.java @@ -29,7 +29,7 @@ public class VXQueryBinaryBooleanInspectorFactory implements IBinaryBooleanInspe @Override public IBinaryBooleanInspector createBinaryBooleanInspector(IHyracksTaskContext ctx) { - final TaggedValuePointable tvp = new TaggedValuePointable(); + final TaggedValuePointable tvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable(); final BooleanPointable bp = (BooleanPointable) BooleanPointable.FACTORY.createPointable(); return new IBinaryBooleanInspector() { @Override http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/de02fe56/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryIntegerInspectorFactory.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryIntegerInspectorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryIntegerInspectorFactory.java index 13d9341..ccab60c 100644 --- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryIntegerInspectorFactory.java +++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryIntegerInspectorFactory.java @@ -29,7 +29,7 @@ public class VXQueryBinaryIntegerInspectorFactory implements IBinaryIntegerInspe @Override public IBinaryIntegerInspector createBinaryIntegerInspector(IHyracksTaskContext ctx) { - final TaggedValuePointable tvp = new TaggedValuePointable(); + final TaggedValuePointable tvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable(); final IntegerPointable ip = (IntegerPointable) IntegerPointable.FACTORY.createPointable(); return new IBinaryIntegerInspector() { @Override http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/de02fe56/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryComparatorFactoryProvider.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryComparatorFactoryProvider.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryComparatorFactoryProvider.java index 67c3891..5a0e2df 100644 --- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryComparatorFactoryProvider.java +++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryComparatorFactoryProvider.java @@ -41,8 +41,8 @@ public class VXQueryComparatorFactoryProvider implements IBinaryComparatorFactor @Override public IBinaryComparator createBinaryComparator() { - final TaggedValuePointable tvp1 = new TaggedValuePointable(); - final TaggedValuePointable tvp2 = new TaggedValuePointable(); + final TaggedValuePointable tvp1 = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable(); + final TaggedValuePointable tvp2 = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable(); return new IBinaryComparator() { @Override public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) { http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/de02fe56/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/EliminateSubplanForSingleItemsRule.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/EliminateSubplanForSingleItemsRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/EliminateSubplanForSingleItemsRule.java index 5c9d4f5..4ba642a 100644 --- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/EliminateSubplanForSingleItemsRule.java +++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/EliminateSubplanForSingleItemsRule.java @@ -164,7 +164,7 @@ public class EliminateSubplanForSingleItemsRule implements IAlgebraicRewriteRule if (argType.getExpressionTag() != LogicalExpressionTag.CONSTANT) { return false; } - TaggedValuePointable tvp = new TaggedValuePointable(); + TaggedValuePointable tvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable(); ExpressionToolbox.getConstantAsPointable((ConstantExpression) argType, tvp); IntegerPointable pTypeCode = (IntegerPointable) IntegerPointable.FACTORY.createPointable(); http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/de02fe56/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveUnusedSortDistinctNodesRule.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveUnusedSortDistinctNodesRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveUnusedSortDistinctNodesRule.java index 89e3ffe..43d636b 100644 --- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveUnusedSortDistinctNodesRule.java +++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveUnusedSortDistinctNodesRule.java @@ -39,11 +39,8 @@ import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalOperatorTag; import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression; import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression; import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator; -import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractOperatorWithNestedPlans; import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AggregateOperator; import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AssignOperator; -import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.InnerJoinOperator; -import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.LeftOuterJoinOperator; import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.NestedTupleSourceOperator; import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.OrderOperator; import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.SubplanOperator; http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/de02fe56/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveUnusedTreatRule.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveUnusedTreatRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveUnusedTreatRule.java index 66edbe8..4b14c50 100644 --- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveUnusedTreatRule.java +++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveUnusedTreatRule.java @@ -106,7 +106,7 @@ public class RemoveUnusedTreatRule implements IAlgebraicRewriteRule { if (treatArg2.getExpressionTag() != LogicalExpressionTag.CONSTANT) { return false; } - TaggedValuePointable tvp = new TaggedValuePointable(); + TaggedValuePointable tvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable(); getConstantAsPointable((ConstantExpression) treatArg2, tvp); IntegerPointable pTypeCode = (IntegerPointable) IntegerPointable.FACTORY.createPointable(); @@ -124,7 +124,7 @@ public class RemoveUnusedTreatRule implements IAlgebraicRewriteRule { .getValue(); if (expressionConstant.getExpressionTag() == LogicalExpressionTag.CONSTANT) { // Check constant against type supplied. - TaggedValuePointable tvp2 = new TaggedValuePointable(); + TaggedValuePointable tvp2 = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable(); getConstantAsPointable((ConstantExpression) expressionConstant, tvp2); SequenceTypeMatcher stm = new SequenceTypeMatcher(); http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/de02fe56/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/SetCollectionDataSourceRule.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/SetCollectionDataSourceRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/SetCollectionDataSourceRule.java index 331a87a..1d81a8c 100644 --- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/SetCollectionDataSourceRule.java +++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/SetCollectionDataSourceRule.java @@ -37,6 +37,9 @@ import edu.uci.ics.hyracks.algebricks.core.algebra.base.IOptimizationContext; public class SetCollectionDataSourceRule extends AbstractCollectionRule { @Override public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException { + if (context.checkIfInDontApplySet(this, opRef.getValue())) { + return false; + } VXQueryOptimizationContext vxqueryContext = (VXQueryOptimizationContext) context; String collectionName = getCollectionName(opRef); @@ -49,6 +52,8 @@ public class SetCollectionDataSourceRule extends AbstractCollectionRule { VXQueryCollectionDataSource ds = new VXQueryCollectionDataSource(collectionId, collectionName, types.toArray()); vxqueryContext.putCollectionDataSourceMap(collectionName, ds); + + context.addToDontApplySet(this, opRef.getValue()); } return false; } http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/de02fe56/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/SetVariableIdContextRule.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/SetVariableIdContextRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/SetVariableIdContextRule.java index 58b050d..b810e39 100644 --- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/SetVariableIdContextRule.java +++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/SetVariableIdContextRule.java @@ -33,6 +33,9 @@ import edu.uci.ics.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule; public class SetVariableIdContextRule implements IAlgebraicRewriteRule { @Override public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException { + if (context.checkIfInDontApplySet(this, opRef.getValue())) { + return false; + } int variableId = 0; // TODO Move the setVarCounter to the compiler after the translator has run. @@ -54,6 +57,7 @@ public class SetVariableIdContextRule implements IAlgebraicRewriteRule { if (context.getVarCounter() <= variableId) { context.setVarCounter(variableId + 1); } + context.addToDontApplySet(this, opRef.getValue()); return false; } http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/de02fe56/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/aggregate/FnAvgScalarEvaluatorFactory.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/aggregate/FnAvgScalarEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/aggregate/FnAvgScalarEvaluatorFactory.java index db1dd7c..17b1b73 100644 --- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/aggregate/FnAvgScalarEvaluatorFactory.java +++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/aggregate/FnAvgScalarEvaluatorFactory.java @@ -36,7 +36,6 @@ import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluator; import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory; import edu.uci.ics.hyracks.api.context.IHyracksTaskContext; import edu.uci.ics.hyracks.data.std.api.IPointable; -import edu.uci.ics.hyracks.data.std.primitive.VoidPointable; import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage; public class FnAvgScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory { @@ -51,7 +50,6 @@ public class FnAvgScalarEvaluatorFactory extends AbstractTaggedValueArgumentScal throws AlgebricksException { final DynamicContext dCtx = (DynamicContext) ctx.getJobletContext().getGlobalJobData(); final SequencePointable seqp = new SequencePointable(); - final VoidPointable p = (VoidPointable) VoidPointable.FACTORY.createPointable(); final TaggedValuePointable tvpNext = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable(); final TaggedValuePointable tvpSum = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable(); final TaggedValuePointable tvpCount = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable(); @@ -72,8 +70,7 @@ public class FnAvgScalarEvaluatorFactory extends AbstractTaggedValueArgumentScal } else { // Add up the sequence. for (int j = 0; j < seqLen; ++j) { - seqp.getEntry(j, p); - tvpNext.set(p.getByteArray(), p.getStartOffset(), p.getLength()); + seqp.getEntry(j, tvpNext); if (j == 0) { // Init. tvpSum.set(tvpNext); http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/de02fe56/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentAggregateEvaluator.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentAggregateEvaluator.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentAggregateEvaluator.java index cdd5847..e39d493 100644 --- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentAggregateEvaluator.java +++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentAggregateEvaluator.java @@ -33,7 +33,7 @@ public abstract class AbstractTaggedValueArgumentAggregateEvaluator implements I this.args = args; tvps = new TaggedValuePointable[args.length]; for (int i = 0; i < tvps.length; ++i) { - tvps[i] = new TaggedValuePointable(); + tvps[i] = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable(); } } http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/de02fe56/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentScalarEvaluator.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentScalarEvaluator.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentScalarEvaluator.java index 7b6581f..4371db8 100644 --- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentScalarEvaluator.java +++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentScalarEvaluator.java @@ -33,7 +33,7 @@ public abstract class AbstractTaggedValueArgumentScalarEvaluator implements ISca this.args = args; tvps = new TaggedValuePointable[args.length]; for (int i = 0; i < tvps.length; ++i) { - tvps[i] = new TaggedValuePointable(); + tvps[i] = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable(); } } http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/de02fe56/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentUnnestingEvaluator.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentUnnestingEvaluator.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentUnnestingEvaluator.java index ee1761f..3a1442f 100644 --- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentUnnestingEvaluator.java +++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentUnnestingEvaluator.java @@ -33,7 +33,7 @@ public abstract class AbstractTaggedValueArgumentUnnestingEvaluator implements I this.args = args; tvps = new TaggedValuePointable[args.length]; for (int i = 0; i < tvps.length; ++i) { - tvps[i] = new TaggedValuePointable(); + tvps[i] = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable(); } } http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/de02fe56/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/AttributePathStepScalarEvaluator.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/AttributePathStepScalarEvaluator.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/AttributePathStepScalarEvaluator.java index 303cd6f..30b50e4 100644 --- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/AttributePathStepScalarEvaluator.java +++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/AttributePathStepScalarEvaluator.java @@ -49,8 +49,6 @@ public class AttributePathStepScalarEvaluator extends AbstractSinglePathStepScal return; } } - TaggedValuePointable seqTvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable(); - XDMConstants.setEmptySequence(seqTvp); - seqTvp.getValue(seqp); + XDMConstants.setEmptySequence(seqp); } } \ No newline at end of file
