drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [05/10] drill git commit: DRILL-1748: Fix SplitUpComplexExpressions rule when using Item operator
Date Sat, 29 Nov 2014 19:16:17 GMT
DRILL-1748: Fix SplitUpComplexExpressions rule when using Item operator


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

Branch: refs/heads/master
Commit: 3a067cf9f7d824aea297c64db414ec8135e94932
Parents: 09aa34b
Author: Mehant Baid <mehantr@gmail.com>
Authored: Wed Nov 26 23:45:09 2014 -0800
Committer: Jason Altekruse <altekrusejason@gmail.com>
Committed: Fri Nov 28 22:28:25 2014 -0800

----------------------------------------------------------------------
 .../planner/physical/visitor/SplitUpComplexExpressions.java   | 7 +------
 .../exec/vector/complex/writer/TestComplexTypeReader.java     | 6 ++++++
 exec/java-exec/src/test/resources/jsoninput/input4.json       | 1 +
 3 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/3a067cf9/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 89c8447..3e685a3 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
@@ -90,17 +90,12 @@ public class SplitUpComplexExpressions extends BasePrelVisitor<Prel,
Object, Rel
 
     ProjectPushInfo columnInfo = PrelUtil.getColumns(project.getInput(0).getRowType(), project.getProjects());
 
-    List<RexNode> newProjects = Lists.newArrayList();
     if (columnInfo == null ) {
       return project;
     }
-    int lastRexInput = columnInfo.columns.size();
+    int lastRexInput = columnInfo.desiredFields.size();
     RexVisitorComplexExprSplitter exprSplitter = new RexVisitorComplexExprSplitter(factory,
funcReg, lastRexInput);
 
-    for (RexNode n : project.getChildExps()) {
-      newProjects.add(n.accept(columnInfo.getInputRewriter()));
-    }
-
     for (RexNode rex : project.getChildExps()) {
       origRelDataTypes.add(project.getRowType().getFieldList().get(i));
       i++;

http://git-wip-us.apache.org/repos/asf/drill/blob/3a067cf9/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestComplexTypeReader.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestComplexTypeReader.java
b/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestComplexTypeReader.java
index 9632bf6..9333523 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestComplexTypeReader.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestComplexTypeReader.java
@@ -212,6 +212,12 @@ public class TestComplexTypeReader extends BaseTestQuery{
   }
 
   @Test
+  // Test SplitUpComplexExpressions rule which splits complex expression into multiple projects
+  public void testComplexAndSimpleColumnSelection() throws Exception {
+    test("select t.a.b, kvgen(t.a.c) from cp.`jsoninput/input4.json` t");
+  }
+
+  @Test
   public void testNestedFlatten() throws Exception {
     test("select flatten(rl) from cp.`jsoninput/input2.json`");
   }

http://git-wip-us.apache.org/repos/asf/drill/blob/3a067cf9/exec/java-exec/src/test/resources/jsoninput/input4.json
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/jsoninput/input4.json b/exec/java-exec/src/test/resources/jsoninput/input4.json
new file mode 100644
index 0000000..7a38c67
--- /dev/null
+++ b/exec/java-exec/src/test/resources/jsoninput/input4.json
@@ -0,0 +1 @@
+{"a" : {"b" : 1, "c": {"d": 2} } }


Mime
View raw message