drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amansi...@apache.org
Subject [2/2] drill git commit: DRILL-4771: Drill should avoid doing the same join twice if count(distinct) exists
Date Tue, 20 Sep 2016 01:28:45 GMT
DRILL-4771: Drill should avoid doing the same join twice if count(distinct) exists

close apache/drill#588


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

Branch: refs/heads/master
Commit: 229571533bce1e37395d9675ea804ee97b1a2362
Parents: 140304d
Author: Gautam Parai <gparai@maprtech.com>
Authored: Mon Sep 12 20:21:46 2016 -0700
Committer: Aman Sinha <asinha@maprtech.com>
Committed: Mon Sep 19 18:20:56 2016 -0700

----------------------------------------------------------------------
 .../java/org/apache/drill/TestBugFixes.java     | 33 ++++++++++++++++++++
 pom.xml                                         |  2 +-
 2 files changed, 34 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/22957153/exec/java-exec/src/test/java/org/apache/drill/TestBugFixes.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/TestBugFixes.java b/exec/java-exec/src/test/java/org/apache/drill/TestBugFixes.java
index c5062b2..5b736bc 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/TestBugFixes.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/TestBugFixes.java
@@ -167,4 +167,37 @@ public class TestBugFixes extends BaseTestQuery {
         .baselineValues("single_top_partition", "nested_partition_1")
         .go();
   }
+
+  @Test
+  public void testDRILL4771() throws Exception {
+    final String query = "select count(*) cnt, avg(distinct emp.department_id) avd\n"
+        + " from cp.`employee.json` emp";
+    final String[] expectedPlans = {
+        ".*Agg\\(group=\\[\\{\\}\\], cnt=\\[\\$SUM0\\(\\$1\\)\\], agg#1=\\[\\$SUM0\\(\\$0\\)\\],
agg#2=\\[COUNT\\(\\$0\\)\\]\\)",
+        ".*Agg\\(group=\\[\\{0\\}\\], cnt=\\[COUNT\\(\\)\\]\\)"};
+    final String[] excludedPlans = {".*Join\\(condition=\\[true\\], joinType=\\[inner\\]\\).*"};
+    PlanTestBase.testPlanMatchingPatterns(query, expectedPlans, excludedPlans);
+    testBuilder()
+        .sqlQuery(query)
+        .unOrdered()
+        .baselineColumns("cnt", "avd")
+        .baselineValues(1155L, 10.416666666666666)
+        .build().run();
+
+    final String query1 = "select emp.gender, count(*) cnt, avg(distinct emp.department_id)
avd\n"
+            + " from cp.`employee.json` emp\n"
+            + " group by gender";
+    final String[] expectedPlans1 = {
+            ".*Agg\\(group=\\[\\{0\\}\\], agg#0=\\[\\$SUM0\\(\\$2\\)\\], agg#1=\\[\\$SUM0\\(\\$1\\)\\],
agg#2=\\[COUNT\\(\\$1\\)\\]\\)",
+            ".*Agg\\(group=\\[\\{0, 1\\}\\], cnt=\\[COUNT\\(\\)\\]\\)"};
+    final String[] excludedPlans1 = {".*Join\\(condition=\\[true\\], joinType=\\[inner\\]\\).*"};
+    PlanTestBase.testPlanMatchingPatterns(query1, expectedPlans1, excludedPlans1);
+    testBuilder()
+            .sqlQuery(query1)
+            .unOrdered()
+            .baselineColumns("gender", "cnt", "avd")
+            .baselineValues("F", 601L, 10.416666666666666)
+            .baselineValues("M", 554L, 11.9)
+            .build().run();
+  }
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/22957153/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index decfcbc..0768720 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1446,7 +1446,7 @@
           <dependency>
             <groupId>org.apache.calcite</groupId>
             <artifactId>calcite-core</artifactId>
-            <version>1.4.0-drill-r17</version>
+            <version>1.4.0-drill-r18</version>
             <exclusions>
               <exclusion>
                 <groupId>org.jgrapht</groupId>


Mime
View raw message