drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [1/2] drill git commit: DRILL-2242 : Propagate distribution trait when Project only outputs a subset of child's distribution field.
Date Fri, 20 Feb 2015 19:03:31 GMT
Repository: drill
Updated Branches:
  refs/heads/master 1ceddff66 -> 3c85bd8aa


DRILL-2242 : Propagate distribution trait when Project only outputs a subset of child's distribution
field.

Minor code style fix.

change to unit test.


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

Branch: refs/heads/master
Commit: 3c85bd8aa412f0a4d361a9a7b3136a03b15c9f37
Parents: b5c1ffe
Author: Jinfeng Ni <jni@apache.org>
Authored: Mon Feb 16 23:41:32 2015 -0800
Committer: Jinfeng Ni <jni@maprtech.com>
Committed: Thu Feb 19 18:52:27 2015 -0800

----------------------------------------------------------------------
 .../exec/planner/physical/ProjectPrule.java     |  4 ++-
 .../exec/fn/impl/TestAggregateFunctions.java    | 29 ++++++++++++++++++++
 2 files changed, 32 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/3c85bd8a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ProjectPrule.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ProjectPrule.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ProjectPrule.java
index 6d26419..732a345 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ProjectPrule.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ProjectPrule.java
@@ -97,7 +97,9 @@ public class ProjectPrule extends Prule {
       }
     }
 
-    if (newFields.isEmpty()) {
+    // After the projection, if the new distribution fields is empty, or new distribution
fields is a subset of
+    // original distribution field, we should replace with either SINGLETON or RANDOM_DISTRIBUTED.
+    if (newFields.isEmpty() || newFields.size() < srcDist.getFields().size()) {
       if (srcDist.getType() != DistributionType.SINGLETON) {
         return DrillDistributionTrait.RANDOM_DISTRIBUTED;
       } else {

http://git-wip-us.apache.org/repos/asf/drill/blob/3c85bd8a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestAggregateFunctions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestAggregateFunctions.java
b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestAggregateFunctions.java
index 543eff8..f8966e8 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestAggregateFunctions.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestAggregateFunctions.java
@@ -128,4 +128,33 @@ public class TestAggregateFunctions extends BaseTestQuery {
         .baselineValues("VIETNAM21", 1L)
         .build().run();
   }
+
+  @Test //DRILL-2242
+  public void testDRILLNestedGBWithSubsetKeys() throws Exception {
+    String sql = " select count(*) as cnt from (select l_partkey from\n" +
+        "   (select l_partkey, l_suppkey from cp.`tpch/lineitem.parquet`\n" +
+        "      group by l_partkey, l_suppkey) \n" +
+        "   group by l_partkey )";
+
+    test("alter session set `planner.slice_target` = 1; alter session set `planner.enable_multiphase_agg`
= false ;");
+
+    testBuilder()
+        .ordered()
+        .sqlQuery(sql)
+        .baselineColumns("cnt")
+        .baselineValues(2000L)
+        .build().run();
+
+    test("alter session set `planner.slice_target` = 1; alter session set `planner.enable_multiphase_agg`
= true ;");
+
+    testBuilder()
+        .ordered()
+        .sqlQuery(sql)
+        .baselineColumns("cnt")
+        .baselineValues(2000L)
+        .build().run();
+
+    test("alter session set `planner.slice_target` = 100000");
+  }
+
 }


Mime
View raw message