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:12:01 UTC
[21/50] [abbrv] git commit: Switched from using shared datasources to
a single datasource per data scan.
Switched from using shared datasources to a single datasource per data scan.
Fixes an issue with self join and pushing child path steps onto the data source scan.
Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/3171202a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/3171202a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/3171202a
Branch: refs/heads/prestonc/hash_join
Commit: 3171202ae93f4f2cce06886d67131adc0b51f360
Parents: 74a22a3
Author: Preston Carman <pr...@apache.org>
Authored: Fri Mar 14 22:07:00 2014 -0700
Committer: Preston Carman <pr...@apache.org>
Committed: Tue Apr 1 20:56:24 2014 -0700
----------------------------------------------------------------------
.../rewriter/VXQueryOptimizationContext.java | 14 ++++++++++++++
.../rewriter/rules/IntroduceCollectionRule.java | 15 +++++++++++++--
.../VXQueryCollectionOperatorDescriptor.java | 1 -
3 files changed, 27 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/3171202a/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 a763649..f86b9d6 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
@@ -38,6 +38,8 @@ public class VXQueryOptimizationContext extends AlgebricksOptimizationContext {
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;
public VXQueryOptimizationContext(int varCounter, IExpressionEvalSizeComputer expressionEvalSizeComputer,
IMergeAggregationExpressionFactory mergeAggregationExpressionFactory,
@@ -63,6 +65,18 @@ public class VXQueryOptimizationContext extends AlgebricksOptimizationContext {
this.dataSourceScanMap.put(collectionName, ds);
}
+ public void incrementTotalDataSources() {
+ totalDataSources++;
+ }
+
+ public int getTotalDataSources() {
+ return totalDataSources;
+ }
+
+ public int newCollectionId() {
+ return ++collectionId;
+ }
+
public Cardinality getCardinalityOperatorMap(ILogicalOperator op) {
if (cardinalityOperatorMap.containsKey(op)) {
return cardinalityOperatorMap.get(op);
http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/3171202a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/IntroduceCollectionRule.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/IntroduceCollectionRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/IntroduceCollectionRule.java
index cbe1008..bc8d58a 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/IntroduceCollectionRule.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/IntroduceCollectionRule.java
@@ -16,9 +16,15 @@
*/
package org.apache.vxquery.compiler.rewriter.rules;
+import java.util.ArrayList;
+import java.util.List;
+
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;
@@ -69,9 +75,14 @@ public class IntroduceCollectionRule extends AbstractCollectionRule {
if (collectionName != null) {
// Build the new operator and update the query plan.
- VXQueryCollectionDataSource ds = vxqueryContext.getCollectionDataSourceMap(collectionName);
+ int collectionId = vxqueryContext.newCollectionId();
+ List<Object> types = new ArrayList<Object>();
+ types.add(SequenceType.create(AnyItemType.INSTANCE, Quantifier.QUANT_STAR));
+
+ VXQueryCollectionDataSource ds = new VXQueryCollectionDataSource(collectionId, collectionName,
+ types.toArray());
if (ds != null) {
- ds.setTotalDataSources(vxqueryContext.getCollectionDataSourceMapSize());
+ ds.setTotalDataSources(vxqueryContext.getTotalDataSources());
// Known to be true because of collection name.
AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();
http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/3171202a/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryCollectionOperatorDescriptor.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryCollectionOperatorDescriptor.java b/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryCollectionOperatorDescriptor.java
index 593b8ad..5cc2276 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryCollectionOperatorDescriptor.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryCollectionOperatorDescriptor.java
@@ -30,7 +30,6 @@ import org.apache.vxquery.exceptions.SystemException;
import org.apache.vxquery.runtime.functions.step.ChildPathStepOperatorDescriptor;
import org.apache.vxquery.runtime.functions.util.FunctionHelper;
import org.apache.vxquery.xmlparser.ITreeNodeIdProvider;
-import org.apache.vxquery.xmlparser.SAXContentHandler;
import org.apache.vxquery.xmlparser.TreeNodeIdProvider;
import org.apache.vxquery.xmlparser.XMLParser;
import org.xml.sax.InputSource;