Repository: drill Updated Branches: refs/heads/master b2e79aac8 -> c040185dd
DRILL-2330: Support for nested aggregates within window functions (merge CALCITE-750), add unit tests. close apache/drill#529 Project: http://git-wip-us.apache.org/repos/asf/drill/repo Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/c040185d Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/c040185d Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/c040185d Branch: refs/heads/master Commit: c040185dd2dd5626c1221a04982fb06060531c0a Parents: b2e79aa Author: Gautam Parai <[email protected]> Authored: Fri Jun 17 18:13:15 2016 -0700 Committer: Aman Sinha <[email protected]> Committed: Thu Jul 14 15:09:43 2016 -0700 ---------------------------------------------------------------------- .../apache/drill/exec/TestWindowFunctions.java | 30 ++++++++++++++++++++ pom.xml | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/drill/blob/c040185d/exec/java-exec/src/test/java/org/apache/drill/exec/TestWindowFunctions.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/TestWindowFunctions.java b/exec/java-exec/src/test/java/org/apache/drill/exec/TestWindowFunctions.java index 1d9900c..2546bca 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/TestWindowFunctions.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/TestWindowFunctions.java @@ -844,4 +844,34 @@ public class TestWindowFunctions extends BaseTestQuery { .build() .run(); } + + @Test // DRILL-2330 + public void testNestedAggregates() throws Exception { + + final String query = "select sum(min(l_extendedprice))" + + " over (partition by l_suppkey order by l_suppkey) as totprice" + + " from cp.`tpch/lineitem.parquet` where l_suppkey <= 10 group by l_suppkey order by 1 desc"; + + // Validate the plan + final String[] expectedPlan = {"Window.*partition \\{0\\} order by \\[0\\].*SUM\\(\\$1\\).*", + "HashAgg\\(group=\\[\\{0\\}\\].*\\[MIN\\(\\$1\\)\\]\\)"}; + PlanTestBase.testPlanMatchingPatterns(query, expectedPlan, new String[]{}); + + // Validate the results + testBuilder() + .sqlQuery(query) + .unOrdered() + .baselineColumns("totprice") + .baselineValues(1107.2) + .baselineValues(998.09) + .baselineValues(957.05) + .baselineValues(953.05) + .baselineValues(931.03) + .baselineValues(926.02) + .baselineValues(909.0) + .baselineValues(906.0) + .baselineValues(904.0) + .baselineValues(904.0) + .go(); + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/drill/blob/c040185d/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 85b834e..8fc0841 100644 --- a/pom.xml +++ b/pom.xml @@ -1287,7 +1287,7 @@ <dependency> <groupId>org.apache.calcite</groupId> <artifactId>calcite-core</artifactId> - <version>1.4.0-drill-r12</version> + <version>1.4.0-drill-r13</version> <exclusions> <exclusion> <groupId>org.jgrapht</groupId>
