Aleksandr Efimov has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/25237 )

Change subject: IMPALA-15699: Fix GROUPING_ID with repeated sets
......................................................................


Patch Set 2:

(12 comments)

http://gerrit.cloudera.org:8080/#/c/25237/2//COMMIT_MSG
Commit Message:

http://gerrit.cloudera.org:8080/#/c/25237/2//COMMIT_MSG@7
PS2, Line 7: IMPALA-15699: Calcite planner: fix grouping masks
> The title sounds vague, could we have something like "…fix GROUPING_ID mask
Updated the title in PS4 to name GROUPING_ID and repeated sets.


http://gerrit.cloudera.org:8080/#/c/25237/2//COMMIT_MSG@10
PS2, Line 10: Bind generated standard GROUPING calls to native BIGINT 
GROUPING_ID.
> Can we add its because Calcite's rewrite only recognizes the GROUPING kind?
Added that Calcite's rewrite only recognizes the GROUPING kind in PS4.


http://gerrit.cloudera.org:8080/#/c/25237/2//COMMIT_MSG@16
PS2, Line 16: fail
> Could you add a short example of a failing query?
Added a short failing SQL example in PS4 and covered it with a regression test.


http://gerrit.cloudera.org:8080/#/c/25237/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/rel/node/ImpalaAggRel.java
File 
java/calcite-planner/src/main/java/org/apache/impala/calcite/rel/node/ImpalaAggRel.java:

http://gerrit.cloudera.org:8080/#/c/25237/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/rel/node/ImpalaAggRel.java@367
PS2, Line 367: partial-mask rewrite
> nit: Itd be clearer to say which Calcite component does this eg. RelBuilder
Named RelBuilder's partial-mask rewrite in PS4.


http://gerrit.cloudera.org:8080/#/c/25237/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/rel/node/ImpalaAggRel.java@370
PS2, Line 370: grouping_id
> nit: Instead of using a magic string, I think using ImpalaCustomOperatorTab
Used ImpalaCustomOperatorTable.GROUPING_ID.getName() in PS4.


http://gerrit.cloudera.org:8080/#/c/25237/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/rel/node/ImpalaAggRel.java@370
PS2, Line 370:
> nit: use 2 space indents.
Fixed the indentation in PS4.


http://gerrit.cloudera.org:8080/#/c/25237/2/java/calcite-planner/src/test/java/org/apache/impala/calcite/service/CalciteGroupingIdTest.java
File 
java/calcite-planner/src/test/java/org/apache/impala/calcite/service/CalciteGroupingIdTest.java:

http://gerrit.cloudera.org:8080/#/c/25237/2/java/calcite-planner/src/test/java/org/apache/impala/calcite/service/CalciteGroupingIdTest.java@55
PS2, Line 55:     assertNativePlan("((b), (a,b), (), (b), ())", " having 
grouping_id(a,b)=3");
> Both repeated-sets use the same grouping sets, we can add a shape with thre
Added a three-key case in PS4. It also includes a (b) set so every GROUPING_ID 
argument is a grouping key.


http://gerrit.cloudera.org:8080/#/c/25237/2/java/calcite-planner/src/test/java/org/apache/impala/calcite/service/CalciteGroupingIdTest.java@60
PS2, Line 60:     for (String sets : List.of("((b), (a,b), ())", "((b), (a,b), 
(), (b))",
> Looping over three cases in one test would stop at the first failure. Could
Split the SQL cases into named parameterized tests in PS4.


http://gerrit.cloudera.org:8080/#/c/25237/2/java/calcite-planner/src/test/java/org/apache/impala/calcite/service/CalciteGroupingIdTest.java@74
PS2, Line 74:     assertNativePlan(sql, true, List.of(Type.INT, Type.BIGINT));
> It replaces every AggregateCall in every Aggregate with SqlStdOperatorTable
PS4 replaces only GROUPING_ID. Added COUNT(*) to the same query as a control.


http://gerrit.cloudera.org:8080/#/c/25237/2/java/calcite-planner/src/test/java/org/apache/impala/calcite/service/CalciteGroupingIdTest.java@88
PS2, Line 88: setDecimal_v2
> Is decimal_v2 needed for this test?
Removed decimal_v2 from the test options in PS4.


http://gerrit.cloudera.org:8080/#/c/25237/2/java/calcite-planner/src/test/java/org/apache/impala/calcite/service/CalciteGroupingIdTest.java@109
PS2, Line 109: var
> No other file in java/calcite-planner uses var. Can we use explicit types?
Replaced var with explicit types in PS4.


http://gerrit.cloudera.org:8080/#/c/25237/2/java/calcite-planner/src/test/java/org/apache/impala/calcite/service/CalciteGroupingIdTest.java@114
PS2, Line 114: expr -> expr.getType()
> nit: can be Expr::getType
Changed to Expr::getType in PS4.



--
To view, visit http://gerrit.cloudera.org:8080/25237
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ieab66c076173c1266492382cffb55e7e2139b84c
Gerrit-Change-Number: 25237
Gerrit-PatchSet: 2
Gerrit-Owner: Aleksandr Efimov <[email protected]>
Gerrit-Reviewer: Aleksandr Efimov <[email protected]>
Gerrit-Reviewer: Arnab Karmakar <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Michael Smith <[email protected]>
Gerrit-Reviewer: Steve Carlin <[email protected]>
Gerrit-Comment-Date: Thu, 29 Oct 2026 10:39:48 +0000
Gerrit-HasComments: Yes

Reply via email to