calcite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [31/50] [abbrv] calcite-avatica git commit: [CALCITE-1706] Disable DruidAggregateFilterTransposeRule, because it causes fine-grained aggregations to be pushed to Druid
Date Thu, 30 Mar 2017 21:38:21 GMT
[CALCITE-1706] Disable DruidAggregateFilterTransposeRule, because it causes fine-grained aggregations
to be pushed to Druid

Also remove some more CAST calls erroneously introduced by [CALCITE-1684].


Project: http://git-wip-us.apache.org/repos/asf/calcite-avatica/repo
Commit: http://git-wip-us.apache.org/repos/asf/calcite-avatica/commit/6b54b6ec
Tree: http://git-wip-us.apache.org/repos/asf/calcite-avatica/tree/6b54b6ec
Diff: http://git-wip-us.apache.org/repos/asf/calcite-avatica/diff/6b54b6ec

Branch: refs/heads/master
Commit: 6b54b6ec1718040980ed9ea60faa0e1814ae3ea4
Parents: 7f46cd5
Author: Julian Hyde <jhyde@apache.org>
Authored: Fri Mar 17 11:47:00 2017 -0700
Committer: Julian Hyde <jhyde@apache.org>
Committed: Fri Mar 17 11:47:00 2017 -0700

----------------------------------------------------------------------
 .../calcite/adapter/druid/DruidRules.java       | 16 ++++++++---
 .../org/apache/calcite/test/DruidAdapterIT.java | 29 ++++++++++++--------
 2 files changed, 29 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6b54b6ec/druid/src/main/java/org/apache/calcite/adapter/druid/DruidRules.java
----------------------------------------------------------------------
diff --git a/druid/src/main/java/org/apache/calcite/adapter/druid/DruidRules.java b/druid/src/main/java/org/apache/calcite/adapter/druid/DruidRules.java
index bb15921..b22809c 100644
--- a/druid/src/main/java/org/apache/calcite/adapter/druid/DruidRules.java
+++ b/druid/src/main/java/org/apache/calcite/adapter/druid/DruidRules.java
@@ -92,10 +92,18 @@ public class DruidRules {
   public static final DruidFilterAggregateTransposeRule FILTER_AGGREGATE_TRANSPOSE_RULE =
       new DruidFilterAggregateTransposeRule();
 
-  public static final List<RelOptRule> RULES = ImmutableList.of(FILTER,
-      PROJECT_FILTER_TRANSPOSE_RULE, AGGREGATE_FILTER_TRANSPOSE_RULE, PROJECT_AGGREGATE,
-      PROJECT, AGGREGATE, FILTER_AGGREGATE_TRANSPOSE_RULE, FILTER_PROJECT_TRANSPOSE_RULE,
-      PROJECT_SORT, SORT, SORT_PROJECT);
+  public static final List<RelOptRule> RULES =
+      ImmutableList.of(FILTER,
+          PROJECT_FILTER_TRANSPOSE_RULE,
+          // Disabled, per
+          //   [CALCITE-1706] DruidAggregateFilterTransposeRule
+          //   causes very fine-grained aggregations to be pushed to Druid
+          // AGGREGATE_FILTER_TRANSPOSE_RULE,
+          PROJECT_AGGREGATE,
+          PROJECT, AGGREGATE,
+          FILTER_AGGREGATE_TRANSPOSE_RULE,
+          FILTER_PROJECT_TRANSPOSE_RULE,
+          PROJECT_SORT, SORT, SORT_PROJECT);
 
   /** Predicate that returns whether Druid can not handle an aggregate. */
   private static final Predicate<Aggregate> BAD_AGG =

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6b54b6ec/druid/src/test/java/org/apache/calcite/test/DruidAdapterIT.java
----------------------------------------------------------------------
diff --git a/druid/src/test/java/org/apache/calcite/test/DruidAdapterIT.java b/druid/src/test/java/org/apache/calcite/test/DruidAdapterIT.java
index bcce57e..4ee32a5 100644
--- a/druid/src/test/java/org/apache/calcite/test/DruidAdapterIT.java
+++ b/druid/src/test/java/org/apache/calcite/test/DruidAdapterIT.java
@@ -89,7 +89,7 @@ public class DruidAdapterIT {
       Util.getBooleanProperty("calcite.test.druid", true);
 
   private static final String VARCHAR_TYPE =
-      "VARCHAR(1) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\"";
+      "VARCHAR CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\"";
 
   /** Whether to run this test. */
   protected boolean enabled() {
@@ -132,7 +132,9 @@ public class DruidAdapterIT {
   @Test public void testSelectDistinctWiki() {
     final String explain = "PLAN="
         + "EnumerableInterpreter\n"
-        + "  DruidQuery(table=[[wiki, wiki]], intervals=[[1900-01-09T00:00:00.000/2992-01-10T00:00:00.000]],
filter=[=(CAST($13):VARCHAR(13) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\",
'Jeremy Corbyn')], groups=[{5}], aggs=[[]])\n";
+        + "  DruidQuery(table=[[wiki, wiki]], "
+        + "intervals=[[1900-01-09T00:00:00.000/2992-01-10T00:00:00.000]], "
+        + "filter=[=($13, 'Jeremy Corbyn')], groups=[{5}], aggs=[[]])\n";
     checkSelectDistinctWiki(WIKI, "wiki")
         .explainContains(explain);
   }
@@ -140,7 +142,9 @@ public class DruidAdapterIT {
   @Test public void testSelectDistinctWikiNoColumns() {
     final String explain = "PLAN="
         + "EnumerableInterpreter\n"
-        + "  DruidQuery(table=[[wiki, wiki]], intervals=[[1900-01-09T00:00:00.000/2992-01-10T00:00:00.000]],
filter=[=(CAST($17):VARCHAR(13) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\",
'Jeremy Corbyn')], groups=[{7}], aggs=[[]])\n";
+        + "  DruidQuery(table=[[wiki, wiki]], "
+        + "intervals=[[1900-01-09T00:00:00.000/2992-01-10T00:00:00.000]], "
+        + "filter=[=($17, 'Jeremy Corbyn')], groups=[{7}], aggs=[[]])\n";
     checkSelectDistinctWiki(WIKI_AUTO, "wiki")
         .explainContains(explain);
   }
@@ -154,8 +158,10 @@ public class DruidAdapterIT {
         + "from \"wikiticker\"\n"
         + "where \"page\" = 'Jeremy Corbyn'";
     final String explain = "PLAN="
-            + "EnumerableInterpreter\n"
-            + "  DruidQuery(table=[[wiki, wikiticker]], intervals=[[1900-01-01T00:00:00.000/3000-01-01T00:00:00.000]],
filter=[=(CAST($17):VARCHAR(13) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\",
'Jeremy Corbyn')], groups=[{7}], aggs=[[]])\n";
+        + "EnumerableInterpreter\n"
+        + "  DruidQuery(table=[[wiki, wikiticker]], "
+        + "intervals=[[1900-01-01T00:00:00.000/3000-01-01T00:00:00.000]], "
+        + "filter=[=($17, 'Jeremy Corbyn')], groups=[{7}], aggs=[[]])\n";
     final String druidQuery = "{'queryType':'groupBy',"
         + "'dataSource':'wikiticker','granularity':'all',"
         + "'dimensions':['countryName'],'limitSpec':{'type':'default'},"
@@ -1302,12 +1308,11 @@ public class DruidAdapterIT {
         + "'granularity':'all',"
         + "'pagingSpec':{'threshold':16384,'fromNext':true},'context':{'druid.query.fetch':false}}";
     final String explain = "PLAN=EnumerableInterpreter\n"
-        + "  DruidQuery(table=[[foodmart, foodmart]], intervals=[[1900-01-09T00:00:00.000/2992-01-10T00:00:00.000]],"
-        + " filter=[AND(=(CAST($3):VARCHAR(24) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\",
'High Top Dried Mushrooms'),"
-        + " OR(=($87, 'Q2'),"
-        + " =($87, 'Q3')),"
-        + " =(CAST($30):VARCHAR(2) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\",
'WA'))],"
-        + " projects=[[$30, $29, $3]])\n";
+        + "  DruidQuery(table=[[foodmart, foodmart]], "
+        + "intervals=[[1900-01-09T00:00:00.000/2992-01-10T00:00:00.000]], "
+        + "filter=[AND(=($3, 'High Top Dried Mushrooms'), "
+        + "OR(=($87, 'Q2'), =($87, 'Q3')), =($30, 'WA'))], "
+        + "projects=[[$30, $29, $3]])\n";
     sql(sql)
         .queryContains(druidChecker(druidQuery))
         .explainContains(explain)
@@ -1354,7 +1359,7 @@ public class DruidAdapterIT {
         + "from \"foodmart\"\n"
         + "where 'High Top Dried Mushrooms' = \"product_name\"";
     final String explain = "EnumerableInterpreter\n"
-        + "  DruidQuery(table=[[foodmart, foodmart]], intervals=[[1900-01-09T00:00:00.000/2992-01-10T00:00:00.000]],
filter=[=('High Top Dried Mushrooms', CAST($3):VARCHAR(24) CHARACTER SET \"ISO-8859-1\" COLLATE
\"ISO-8859-1$en_US$primary\")], projects=[[$30]])";
+        + "  DruidQuery(table=[[foodmart, foodmart]], intervals=[[1900-01-09T00:00:00.000/2992-01-10T00:00:00.000]],
filter=[=('High Top Dried Mushrooms', $3)], projects=[[$30]])";
     final String druidQuery = "'filter':{'type':'selector','dimension':'product_name',"
         + "'value':'High Top Dried Mushrooms'}";
     sql(sql)


Mime
View raw message