You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by ja...@apache.org on 2015/05/10 20:03:29 UTC

[7/7] drill git commit: DRILL-3012: Fix issue where remote values rel wasn't losing operatorId.

DRILL-3012: Fix issue where remote values rel wasn't losing operatorId.

Also enhance Union rule to avoid more than 2 ways inputs


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/87051d42
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/87051d42
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/87051d42

Branch: refs/heads/master
Commit: 87051d42176c346bfda0d4a9400a0134cdcf566c
Parents: 684389d
Author: Jacques Nadeau <ja...@apache.org>
Authored: Sun May 10 07:46:54 2015 -0700
Committer: Jacques Nadeau <ja...@apache.org>
Committed: Sun May 10 09:26:01 2015 -0700

----------------------------------------------------------------------
 .../drill/exec/physical/config/Values.java      |  2 +-
 .../drill/exec/planner/physical/Prel.java       |  4 +++-
 .../exec/planner/physical/UnionAllPrule.java    | 22 ++++++++++-------
 .../drill/exec/planner/physical/ValuesPrel.java | 25 +++++++++++++++-----
 4 files changed, 37 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/87051d42/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/Values.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/Values.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/Values.java
index fbb069b..ab3952a 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/Values.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/Values.java
@@ -55,7 +55,7 @@ public class Values extends AbstractBase implements Leaf {
   @Override
   public PhysicalOperator getNewWithChildren(List<PhysicalOperator> children) throws ExecutionSetupException {
     assert children.isEmpty();
-    return this;
+    return new Values(content);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/drill/blob/87051d42/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/Prel.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/Prel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/Prel.java
index 697d5a5..db37040 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/Prel.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/Prel.java
@@ -19,11 +19,11 @@ package org.apache.drill.exec.planner.physical;
 
 import java.io.IOException;
 
+import org.apache.calcite.plan.Convention;
 import org.apache.drill.exec.physical.base.PhysicalOperator;
 import org.apache.drill.exec.planner.common.DrillRelNode;
 import org.apache.drill.exec.planner.physical.visitor.PrelVisitor;
 import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode;
-import org.apache.calcite.plan.Convention;
 
 public interface Prel extends DrillRelNode, Iterable<Prel>{
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Prel.class);
@@ -45,4 +45,6 @@ public interface Prel extends DrillRelNode, Iterable<Prel>{
   public SelectionVectorMode getEncoding();
   boolean needsFinalColumnReordering();
 
+  // DRILL-3011
+  // public abstract Prel copy(RelTraitSet paramRelTraitSet, List<RelNode> paramList);
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/87051d42/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionAllPrule.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionAllPrule.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionAllPrule.java
index 0503b44..51cf866 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionAllPrule.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionAllPrule.java
@@ -20,15 +20,17 @@ package org.apache.drill.exec.planner.physical;
 import java.util.List;
 import java.util.logging.Logger;
 
-import org.apache.drill.exec.planner.logical.DrillUnionRel;
-import org.apache.drill.exec.planner.logical.RelOptHelper;
-import org.apache.calcite.rel.InvalidRelException;
-import org.apache.calcite.rel.RelNode;
 import org.apache.calcite.plan.RelOptRule;
 import org.apache.calcite.plan.RelOptRuleCall;
 import org.apache.calcite.plan.RelTraitSet;
+import org.apache.calcite.rel.InvalidRelException;
+import org.apache.calcite.rel.RelNode;
 import org.apache.calcite.util.trace.CalciteTrace;
+import org.apache.drill.exec.planner.logical.DrillUnionRel;
+import org.apache.drill.exec.planner.logical.RelOptHelper;
 
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Lists;
 
 public class UnionAllPrule extends Prule {
@@ -60,11 +62,15 @@ public class UnionAllPrule extends Prule {
       }
 
       traits = call.getPlanner().emptyTraitSet().plus(Prel.DRILL_PHYSICAL).plus(DrillDistributionTrait.SINGLETON);
-      UnionAllPrel unionAll =
-          new UnionAllPrel(union.getCluster(), traits, convertedInputList,
-              false /* compatibility already checked during logical phase */);
 
-      call.transformTo(unionAll);
+      Preconditions.checkArgument(convertedInputList.size() >= 2, "Union list must be at least two items.");
+      RelNode left = convertedInputList.get(0);
+      for (int i = 1; i < convertedInputList.size(); i++) {
+        left = new UnionAllPrel(union.getCluster(), traits, ImmutableList.of(left, convertedInputList.get(i)),
+            false /* compatibility already checked during logical phase */);
+
+      }
+      call.transformTo(left);
 
     } catch (InvalidRelException e) {
       tracer.warning(e.toString());

http://git-wip-us.apache.org/repos/asf/drill/blob/87051d42/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ValuesPrel.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ValuesPrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ValuesPrel.java
index be5bb19..cdb4787 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ValuesPrel.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ValuesPrel.java
@@ -19,15 +19,18 @@ package org.apache.drill.exec.planner.physical;
 
 import java.io.IOException;
 import java.util.Iterator;
+import java.util.List;
 
+import org.apache.calcite.plan.RelOptCluster;
+import org.apache.calcite.plan.RelTraitSet;
+import org.apache.calcite.rel.AbstractRelNode;
+import org.apache.calcite.rel.RelNode;
+import org.apache.calcite.rel.type.RelDataType;
 import org.apache.drill.common.JSONOptions;
+import org.apache.drill.exec.physical.base.PhysicalOperator;
 import org.apache.drill.exec.physical.config.Values;
 import org.apache.drill.exec.planner.physical.visitor.PrelVisitor;
 import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode;
-import org.apache.calcite.rel.AbstractRelNode;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.type.RelDataType;
 
 import com.google.common.collect.Iterators;
 
@@ -50,8 +53,18 @@ public class ValuesPrel extends AbstractRelNode implements Prel {
   }
 
   @Override
-  public Values getPhysicalOperator(PhysicalPlanCreator creator) throws IOException {
-    return new Values(content);
+  public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException {
+    return creator.addMetadata(this, new Values(content));
+  }
+
+  @Override
+  public Prel copy(RelTraitSet traitSet, List<RelNode> inputs) {
+    return new ValuesPrel(getCluster(), traitSet, rowType, content);
+  }
+
+  @Override
+  protected Object clone() throws CloneNotSupportedException {
+    return super.clone();
   }
 
   @Override