vlsi commented on a change in pull request #1756: [CALCITE-1824] GROUP_ID
returns wrong result
URL: https://github.com/apache/calcite/pull/1756#discussion_r366179020
##########
File path: core/src/test/java/org/apache/calcite/test/JdbcTest.java
##########
@@ -4488,6 +4488,37 @@ private void startOfGroupStep3(String startOfGroup) {
"empid=100; deptno=10; name=Bill; salary=10000.0;
commission=1000\n");
}
+ /** Test case for
+ * <a
href="https://issues.apache.org/jira/browse/CALCITE-1824">[CALCITE-1824]
+ * GROUP_ID returns wrong result</a>. */
+ @Test public void testGroupId() {
+ CalciteAssert.that()
+ .with(CalciteAssert.Config.SCOTT)
+ .query("select deptno, group_id() + 1 as g, count(*) as c\n"
+ + "from \"scott\".emp\n"
+ + "group by grouping sets (deptno, deptno, deptno, (), ())\n"
+ + "having group_id() > 0")
+ .explainContains("EnumerableCalc(expr#0..2=[{inputs}], expr#3=[1],
expr#4=[+($t1, $t3)], "
+ + "expr#5=[0], expr#6=[>($t1, $t5)], DEPTNO=[$t0], G=[$t4],
C=[$t2], $condition=[$t6])\n"
+ + " EnumerableUnion(all=[true])\n"
+ + " EnumerableCalc(expr#0..1=[{inputs}], expr#2=[0:BIGINT],
DEPTNO=[$t0], $f1=[$t2], C=[$t1])\n"
+ + " EnumerableAggregate(group=[{7}], groups=[[{7}, {}]],
C=[COUNT()])\n"
Review comment:
Why `{}` is in the groups?
Should it be `groups=[[{7}}]]`?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services