You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by jh...@apache.org on 2015/12/13 23:01:31 UTC

[5/7] calcite git commit: [CALCITE-1016] "GROUP BY constant" on empty relation should return 0 rows

[CALCITE-1016] "GROUP BY constant" on empty relation should return 0 rows


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

Branch: refs/heads/master
Commit: 02e7ad61321f9690b41cc1c93c6b9c92fb925451
Parents: 8c2bc8f
Author: Julian Hyde <jh...@apache.org>
Authored: Fri Dec 11 13:57:24 2015 -0800
Committer: Julian Hyde <jh...@apache.org>
Committed: Sat Dec 12 13:41:15 2015 -0800

----------------------------------------------------------------------
 core/src/test/resources/sql/agg.iq | 129 ++++++++++++++++++++++++++++++++
 1 file changed, 129 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite/blob/02e7ad61/core/src/test/resources/sql/agg.iq
----------------------------------------------------------------------
diff --git a/core/src/test/resources/sql/agg.iq b/core/src/test/resources/sql/agg.iq
index 8e5770e..28aca38 100644
--- a/core/src/test/resources/sql/agg.iq
+++ b/core/src/test/resources/sql/agg.iq
@@ -1249,6 +1249,135 @@ EnumerableCalc(expr#0..2=[{inputs}], EMPNO=[$t1], DEPTNO=[$t0])
       EnumerableTableScan(table=[[scott, EMP]])
 !plan
 
+# [CALCITE-1016] "GROUP BY constant" on empty relation should return 0 rows
+# Should return 0 rows
+select '1' from "scott".emp where false group by 1;
++--------+
+| EXPR$0 |
++--------+
++--------+
+(0 rows)
+
+!ok
+
+# Should return 0 rows
+select count('1') from "scott".emp where false group by 1;
++--------+
+| EXPR$0 |
++--------+
++--------+
+(0 rows)
+
+!ok
+
+# Should return 1 row
+select count('1') from "scott".emp where false group by ();
++--------+
+| EXPR$0 |
++--------+
+|      0 |
++--------+
+(1 row)
+
+!ok
+
+# Should return 1 row
+select count('1') from "scott".emp where false;
++--------+
+| EXPR$0 |
++--------+
+|      0 |
++--------+
+(1 row)
+
+!ok
+
+# As above, but on VALUES rather than table
+# Should return 0 rows
+select '1' from (values (1, 2), (3, 4)) where false group by 1;
++--------+
+| EXPR$0 |
++--------+
++--------+
+(0 rows)
+
+!ok
+
+# Should return 0 rows
+select count('1') from (values (1, 2), (3, 4)) where false group by 1;
++--------+
+| EXPR$0 |
++--------+
++--------+
+(0 rows)
+
+!ok
+
+# Should return 1 row
+select count('1') from (values (1, 2), (3, 4)) where false group by ();
++--------+
+| EXPR$0 |
++--------+
+|      0 |
++--------+
+(1 row)
+
+!ok
+
+# Should return 1 row
+select count('1') from (values (1, 2), (3, 4)) where false;
++--------+
+| EXPR$0 |
++--------+
+|      0 |
++--------+
+(1 row)
+
+!ok
+
+# As above, but on join
+# Should return 0 rows
+select '1' from "scott".emp join "scott".dept using (deptno) where false group by 1;
++--------+
+| EXPR$0 |
++--------+
++--------+
+(0 rows)
+
+!ok
+
+# Should return 0 rows
+select count('1') from "scott".emp join "scott".dept using (deptno) where false group by 1;
++--------+
+| EXPR$0 |
++--------+
++--------+
+(0 rows)
+
+!ok
+
+# Should return 1 row
+select count('1') from "scott".emp join "scott".dept using (deptno) where false group by ();
++--------+
+| EXPR$0 |
++--------+
+|      0 |
++--------+
+(1 row)
+
+!ok
+
+# Should return 1 row
+select count('1') from "scott".emp join "scott".dept using (deptno) where false;
++--------+
+| EXPR$0 |
++--------+
+|      0 |
++--------+
+(1 row)
+
+!ok
+
 # [CALCITE-729] IndexOutOfBoundsException in ROLLUP query on JDBC data source
 !use jdbc_scott
 select deptno, job, count(*) as c