From a4f81a6471d7d7e47b14141eb3c3e8810b8b3830 Mon Sep 17 00:00:00 2001 From: Gian Merlino Date: Fri, 6 Jan 2017 14:45:17 -0800 Subject: [PATCH] Update to Calcite 1.11.0. (#3825) --- pom.xml | 9 ++++-- sql/pom.xml | 4 +++ .../sql/calcite/planner/DruidPlannerImpl.java | 7 +++++ .../druid/sql/calcite/CalciteQueryTest.java | 28 ------------------- 4 files changed, 18 insertions(+), 30 deletions(-) diff --git a/pom.xml b/pom.xml index f370498d8e3..3e132d0e3cf 100644 --- a/pom.xml +++ b/pom.xml @@ -59,8 +59,8 @@ 2.11.1 - 1.8.0 - 1.10.0 + 1.9.0 + 1.11.0 16.0.1 4.1.0 9.2.5.v20141112 @@ -262,6 +262,11 @@ calcite-linq4j ${calcite.version} + + org.apache.calcite.avatica + avatica-core + ${avatica.version} + org.apache.calcite.avatica avatica-server diff --git a/sql/pom.xml b/sql/pom.xml index 385f906e7cf..7027584da94 100644 --- a/sql/pom.xml +++ b/sql/pom.xml @@ -46,6 +46,10 @@ org.apache.calcite calcite-linq4j + + org.apache.calcite.avatica + avatica-core + org.apache.calcite.avatica avatica-server diff --git a/sql/src/main/java/io/druid/sql/calcite/planner/DruidPlannerImpl.java b/sql/src/main/java/io/druid/sql/calcite/planner/DruidPlannerImpl.java index 4665a94ccd9..403f735fea4 100644 --- a/sql/src/main/java/io/druid/sql/calcite/planner/DruidPlannerImpl.java +++ b/sql/src/main/java/io/druid/sql/calcite/planner/DruidPlannerImpl.java @@ -27,6 +27,7 @@ import org.apache.calcite.plan.RelOptRule; import org.apache.calcite.plan.volcano.VolcanoPlanner; import org.apache.calcite.prepare.CalcitePrepareImpl; import org.apache.calcite.rel.RelCollationTraitDef; +import org.apache.calcite.sql2rel.SqlRexConvertletTable; /** * Our very own subclass of CalcitePrepareImpl, used to alter behaviors of the JDBC driver as necessary. @@ -65,4 +66,10 @@ public class DruidPlannerImpl extends CalcitePrepareImpl return planner; } + + @Override + protected SqlRexConvertletTable createConvertletTable() + { + return DruidConvertletTable.instance(); + } } diff --git a/sql/src/test/java/io/druid/sql/calcite/CalciteQueryTest.java b/sql/src/test/java/io/druid/sql/calcite/CalciteQueryTest.java index a4399d5c17b..2f65f1535b2 100644 --- a/sql/src/test/java/io/druid/sql/calcite/CalciteQueryTest.java +++ b/sql/src/test/java/io/druid/sql/calcite/CalciteQueryTest.java @@ -106,9 +106,6 @@ public class CalciteQueryTest { private static final Logger log = new Logger(CalciteQueryTest.class); - // Used to mark tests that should pass once Calcite 1.11.0 is released. - private static final boolean CALCITE_1_11_0 = false; - private static final PlannerConfig PLANNER_CONFIG_DEFAULT = new PlannerConfig(); private static final PlannerConfig PLANNER_CONFIG_NO_TOPN = new PlannerConfig() { @@ -588,11 +585,6 @@ public class CalciteQueryTest @Test public void testGroupByNothingWithLiterallyFalseFilter() throws Exception { - if (!CALCITE_1_11_0) { - // https://issues.apache.org/jira/browse/CALCITE-1488 - return; - } - testQuery( "SELECT COUNT(*), MAX(cnt) FROM druid.foo WHERE 1 = 0", ImmutableList.of(), @@ -605,11 +597,6 @@ public class CalciteQueryTest @Test public void testGroupByOneColumnWithLiterallyFalseFilter() throws Exception { - if (!CALCITE_1_11_0) { - // https://issues.apache.org/jira/browse/CALCITE-1488 - return; - } - testQuery( "SELECT COUNT(*), MAX(cnt) FROM druid.foo WHERE 1 = 0 GROUP BY dim1", ImmutableList.of(), @@ -2002,11 +1989,6 @@ public class CalciteQueryTest @Test public void testGroupByExtractYear() throws Exception { - if (!CALCITE_1_11_0) { - // https://issues.apache.org/jira/browse/CALCITE-1509 - return; - } - testQuery( "SELECT\n" + " EXTRACT(YEAR FROM __time) AS \"year\",\n" @@ -2053,11 +2035,6 @@ public class CalciteQueryTest @Test public void testExtractFloorTime() throws Exception { - if (!CALCITE_1_11_0) { - // https://issues.apache.org/jira/browse/CALCITE-1509 - return; - } - testQuery( "SELECT\n" + "EXTRACT(YEAR FROM FLOOR(__time TO YEAR)) AS \"year\", SUM(cnt)\n" @@ -2272,11 +2249,6 @@ public class CalciteQueryTest @Test public void testUsingSubqueryAsFilterOnTwoColumns() throws Exception { - if (!CALCITE_1_11_0) { - // https://issues.apache.org/jira/browse/CALCITE-1479 - return; - } - testQuery( "SELECT __time, cnt, dim1, dim2 FROM druid.foo " + " WHERE (dim1, dim2) IN ("