drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amansi...@apache.org
Subject drill git commit: DRILL-1500: Partial fix: Don't overwrite top level ProjectPrel that allows duplicates (this was happening during flatten planning phase).
Date Mon, 12 Jan 2015 22:49:12 GMT
Repository: drill
Updated Branches:
  refs/heads/master 487d98e58 -> 5b012bf28


DRILL-1500: Partial fix: Don't overwrite top level ProjectPrel that allows duplicates (this
was happening during flatten planning phase).


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

Branch: refs/heads/master
Commit: 5b012bf288738c2c76ef75692e4db467a5844574
Parents: 487d98e
Author: Aman Sinha <asinha@maprtech.com>
Authored: Mon Jan 12 10:58:50 2015 -0800
Committer: Aman Sinha <asinha@maprtech.com>
Committed: Mon Jan 12 14:44:30 2015 -0800

----------------------------------------------------------------------
 .../exec/planner/physical/ProjectAllowDupPrel.java     |  6 ++++++
 .../physical/visitor/RewriteProjectToFlatten.java      |  2 +-
 .../physical/visitor/SplitUpComplexExpressions.java    |  2 +-
 .../exec/planner/sql/handlers/DefaultSqlHandler.java   | 13 ++++++++-----
 4 files changed, 16 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/5b012bf2/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ProjectAllowDupPrel.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ProjectAllowDupPrel.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ProjectAllowDupPrel.java
index 57dfdb4..26bb9f6 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ProjectAllowDupPrel.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ProjectAllowDupPrel.java
@@ -28,6 +28,7 @@ import org.apache.drill.exec.physical.base.PhysicalOperator;
 import org.apache.drill.exec.physical.config.Project;
 import org.apache.drill.exec.planner.logical.DrillOptiq;
 import org.apache.drill.exec.planner.logical.DrillParseContext;
+import org.eigenbase.rel.ProjectRelBase;
 import org.eigenbase.rel.RelNode;
 import org.eigenbase.relopt.RelOptCluster;
 import org.eigenbase.relopt.RelTraitSet;
@@ -45,6 +46,11 @@ public class ProjectAllowDupPrel extends ProjectPrel {
   }
 
   @Override
+  public ProjectAllowDupPrel copy(RelTraitSet traitSet, RelNode input, List<RexNode>
exps, RelDataType rowType) {
+    return new ProjectAllowDupPrel(getCluster(), traitSet, input, exps, rowType);
+  }
+
+  @Override
   public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException
{
     Prel child = (Prel) this.getChild();
 

http://git-wip-us.apache.org/repos/asf/drill/blob/5b012bf2/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/RewriteProjectToFlatten.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/RewriteProjectToFlatten.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/RewriteProjectToFlatten.java
index 1055411..bedc7bc 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/RewriteProjectToFlatten.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/RewriteProjectToFlatten.java
@@ -108,7 +108,7 @@ public class RewriteProjectToFlatten extends BasePrelVisitor<Prel,
Object, RelCo
     }
 
     Prel child = ((Prel)project.getChild()).accept(this, null);
-    return new ProjectPrel(node.getCluster(), project.getTraitSet(), child, exprList, new
RelRecordType(relDataTypes));
+    return (Prel) project.copy(project.getTraitSet(), child, exprList, new RelRecordType(relDataTypes));
   }
 
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/5b012bf2/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/SplitUpComplexExpressions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/SplitUpComplexExpressions.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/SplitUpComplexExpressions.java
index 3e685a3..11b6c43 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/SplitUpComplexExpressions.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/SplitUpComplexExpressions.java
@@ -136,6 +136,6 @@ public class SplitUpComplexExpressions extends BasePrelVisitor<Prel,
Object, Rel
       allExprs.add(builder.makeInputRef( new RelDataTypeDrillImpl(new RelDataTypeHolder(),
factory), index));
       relDataTypes.add(new RelDataTypeFieldImpl("EXPR$" + index, allExprs.size(), factory.createSqlType(SqlTypeName.ANY)
));
     }
-    return new ProjectPrel(project.getCluster(), project.getTraitSet(), originalInput, exprList,
new RelRecordType(origRelDataTypes));
+    return (Prel) project.copy(project.getTraitSet(), originalInput, exprList, new RelRecordType(origRelDataTypes));
   }
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/5b012bf2/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java
index bacee08..83d2d0b 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java
@@ -196,13 +196,16 @@ public class DefaultSqlHandler extends AbstractSqlHandler {
      */
     phyRelNode = JoinPrelRenameVisitor.insertRenameProject(phyRelNode);
 
-    // TODO - re-enable once execution issues are resolved. This rule allows for several
flatten operations to appear
-    // within a single query, it also breaks up all expressions with complex outputs into
their own project operations.
-    // It currently appears to be producing good plans, but for the flatten case it is revealing
execution errors in the
-    // project operator.
+    /*
+     * 1.1) Break up all expressions with complex outputs into their own project operations
+     */
     phyRelNode = ((Prel) phyRelNode).accept(new SplitUpComplexExpressions(planner.getTypeFactory(),
context.getDrillOperatorTable(), context.getPlannerSettings().functionImplementationRegistry),
null);
+
+    /*
+     * 1.2) Projections that contain reference to flatten are rewritten as Flatten operators
followed by Project
+     */
     phyRelNode = ((Prel) phyRelNode).accept(new RewriteProjectToFlatten(planner.getTypeFactory(),
context.getDrillOperatorTable()), null);
-    // Definitely before this one
+
     /*
      * 2.)
      * Since our operators work via names rather than indices, we have to make to reorder
any


Mime
View raw message