You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by am...@apache.org on 2016/08/09 14:50:40 UTC
drill git commit: DRILL-4795: Nested aggregate windowed query fails -
IllegalStateException
Repository: drill
Updated Branches:
refs/heads/master aaf220ffd -> 0bac42dec
DRILL-4795: Nested aggregate windowed query fails - IllegalStateException
close apache/drill#563
Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/0bac42de
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/0bac42de
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/0bac42de
Branch: refs/heads/master
Commit: 0bac42dec63a46ca787f6c5fe5a51b9a97e0d6cc
Parents: aaf220f
Author: Gautam Parai <gp...@maprtech.com>
Authored: Fri Aug 5 18:06:34 2016 -0700
Committer: Aman Sinha <as...@maprtech.com>
Committed: Tue Aug 9 07:33:27 2016 -0700
----------------------------------------------------------------------
.../apache/drill/exec/TestWindowFunctions.java | 59 +++++++++++++++++++-
pom.xml | 2 +-
2 files changed, 57 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/drill/blob/0bac42de/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 2546bca..01af818 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
@@ -848,9 +848,9 @@ public class TestWindowFunctions extends BaseTestQuery {
@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";
+ 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\\).*",
@@ -874,4 +874,57 @@ public class TestWindowFunctions extends BaseTestQuery {
.baselineValues(904.0)
.go();
}
+
+ @Test // DRILL-4795, DRILL-4796
+ public void testNestedAggregates1() throws Exception {
+ try {
+ String query = "select sum(min(l_extendedprice)) over (partition by l_suppkey)\n"
+ + " from cp.`tpch/nation.parquet` where l_suppkey <= 10";
+ test(query);
+ } catch(UserException ex) {
+ assert(ex.getMessage().contains("Expression 'l_suppkey' is not being grouped"));
+ }
+
+ try {
+ String query = "select sum(min(l_extendedprice)) over (partition by l_suppkey) as totprice\n"
+ + " from cp.`tpch/nation.parquet` where l_suppkey <= 10";
+ test(query);
+ } catch(UserException ex) {
+ assert(ex.getMessage().contains("Expression 'l_suppkey' is not being grouped"));
+ }
+
+ try {
+ String query = "select sum(min(l_extendedprice)) over w1 as totprice\n"
+ + " from cp.`tpch/nation.parquet` where l_suppkey <= 10\n"
+ + " window w1 as (partition by l_suppkey)";
+ test(query);
+ } catch(UserException ex) {
+ assert(ex.getMessage().contains("Expression 'tpch/nation.parquet.l_suppkey' is not being grouped"));
+ }
+
+ try {
+ String query = "select sum(min(l_extendedprice)) over (partition by n_nationkey)\n"
+ + " from cp.`tpch/nation.parquet` where l_suppkey <= 10 group by l_suppkey";
+ test(query);
+ } catch(UserException ex) {
+ assert(ex.getMessage().contains("Expression 'n_nationkey' is not being grouped"));
+ }
+
+ try {
+ String query = "select sum(min(l_extendedprice)) over (partition by n_nationkey) as totprice\n"
+ + " from cp.`tpch/nation.parquet` where l_suppkey <= 10 group by l_suppkey";
+ test(query);
+ } catch(UserException ex) {
+ assert(ex.getMessage().contains("Expression 'n_nationkey' is not being grouped"));
+ }
+
+ try {
+ String query = "select sum(min(l_extendedprice)) over w2 as totprice\n"
+ + " from cp.`tpch/nation.parquet` where l_suppkey <= 10 group by l_suppkey\n"
+ + " window w2 as (partition by n_nationkey)";
+ test(query);
+ } catch(UserException ex) {
+ assert(ex.getMessage().contains("Expression 'tpch/nation.parquet.n_nationkey' is not being grouped"));
+ }
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/0bac42de/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 63d686a..9f9a9be 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-r15</version>
+ <version>1.4.0-drill-r17</version>
<exclusions>
<exclusion>
<groupId>org.jgrapht</groupId>