Removed extra collection context variables. Set collection only counts the number of collections instead of adding each one to the context.
Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/e5535440 Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/e5535440 Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/e5535440 Branch: refs/heads/master Commit: e55354408f5732d0d1dafb6f26661a480d0076f2 Parents: e229502 Author: Preston Carman <[email protected]> Authored: Sun Apr 6 09:09:01 2014 -0700 Committer: Preston Carman <[email protected]> Committed: Sun Apr 6 09:09:08 2014 -0700 ---------------------------------------------------------------------- .../rewriter/VXQueryOptimizationContext.java | 18 ------------------ .../rules/SetCollectionDataSourceRule.java | 17 ++--------------- 2 files changed, 2 insertions(+), 33 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/e5535440/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/VXQueryOptimizationContext.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/VXQueryOptimizationContext.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/VXQueryOptimizationContext.java index f86b9d6..b2a6f1a 100644 --- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/VXQueryOptimizationContext.java +++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/VXQueryOptimizationContext.java @@ -20,7 +20,6 @@ import java.util.Map; import org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.cardinality.Cardinality; import org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.documentorder.DocumentOrder; import org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.uniquenodes.UniqueNodes; -import org.apache.vxquery.metadata.VXQueryCollectionDataSource; import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalOperator; import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IExpressionEvalSizeComputer; @@ -37,7 +36,6 @@ public class VXQueryOptimizationContext extends AlgebricksOptimizationContext { private final Map<ILogicalOperator, HashMap<Integer, UniqueNodes>> uniqueNodesOperatorVariableMap = new HashMap<ILogicalOperator, HashMap<Integer, UniqueNodes>>(); private final Map<ILogicalOperator, Cardinality> cardinalityOperatorMap = new HashMap<ILogicalOperator, Cardinality>(); - private final Map<String, VXQueryCollectionDataSource> dataSourceScanMap = new HashMap<String, VXQueryCollectionDataSource>(); private int totalDataSources = 0; private int collectionId = 0; @@ -49,22 +47,6 @@ public class VXQueryOptimizationContext extends AlgebricksOptimizationContext { nullableTypeComputer, physicalOptimizationConfig, prettyPrintVisitor); } - public VXQueryCollectionDataSource getCollectionDataSourceMap(String collectionName) { - if (dataSourceScanMap.containsKey(collectionName)) { - return dataSourceScanMap.get(collectionName); - } else { - return null; - } - } - - public int getCollectionDataSourceMapSize() { - return dataSourceScanMap.size(); - } - - public void putCollectionDataSourceMap(String collectionName, VXQueryCollectionDataSource ds) { - this.dataSourceScanMap.put(collectionName, ds); - } - public void incrementTotalDataSources() { totalDataSources++; } http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/e5535440/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 2ddee4d..496a99c 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 @@ -18,10 +18,6 @@ package org.apache.vxquery.compiler.rewriter.rules; import org.apache.commons.lang3.mutable.Mutable; import org.apache.vxquery.compiler.rewriter.VXQueryOptimizationContext; -import org.apache.vxquery.metadata.VXQueryCollectionDataSource; -import org.apache.vxquery.types.AnyItemType; -import org.apache.vxquery.types.Quantifier; -import org.apache.vxquery.types.SequenceType; import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException; import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalOperator; @@ -38,17 +34,8 @@ public class SetCollectionDataSourceRule extends AbstractCollectionRule { return false; } VXQueryOptimizationContext vxqueryContext = (VXQueryOptimizationContext) context; - String collectionName = getCollectionName(opRef); - - // Build the new collection. - if (collectionName != null && vxqueryContext.getCollectionDataSourceMap(collectionName) == null) { - int collectionId = vxqueryContext.getCollectionDataSourceMapSize() + 1; - VXQueryCollectionDataSource ds = VXQueryCollectionDataSource.create(collectionId, collectionName, - SequenceType.create(AnyItemType.INSTANCE, Quantifier.QUANT_STAR)); - vxqueryContext.putCollectionDataSourceMap(collectionName, ds); - - context.addToDontApplySet(this, opRef.getValue()); - } + vxqueryContext.incrementTotalDataSources(); + context.addToDontApplySet(this, opRef.getValue()); return false; } }
