Aleksandr Efimov has posted comments on this change. ( http://gerrit.cloudera.org:8080/24257 )
Change subject: IMPALA-14940: Calcite planner: handle broadcast and shuffle hints. ...................................................................... Patch Set 6: (3 comments) http://gerrit.cloudera.org:8080/#/c/24257/6/java/calcite-planner/src/main/codegen/templates/Parser.jj File java/calcite-planner/src/main/codegen/templates/Parser.jj: http://gerrit.cloudera.org:8080/#/c/24257/6/java/calcite-planner/src/main/codegen/templates/Parser.jj@1973 PS6, Line 1973: <HINT_BEG> AddHint(hints) ( <COMMA> AddHint(hints) )* <COMMENT_END> These join hints all end up in the same `SqlSelect.hints` list. Calcite propagates every JOIN hint from that list to every join below it. For example, with `... join [broadcast] b ... join [shuffle] c ...`, both joins get both hints, and the current `ImpalaJoinRel` code makes both of them broadcast. Can we keep each hint associated with the join where it was written? A Calcite plan test with mixed hints would catch this. http://gerrit.cloudera.org:8080/#/c/24257/6/java/calcite-planner/src/main/codegen/templates/Parser.jj@2094 PS6, Line 2094: return new SqlJoin(joinType.getParserPosition(), Could we limit this rewrite to a plain/inner join? As written, `LEFT`, `RIGHT`, and `FULL JOIN` without `ON` or `USING` are changed to a COMMA join before validation. The classic planner rejects these queries, but Calcite would accept them as an inner/cross join, which changes the query semantics. http://gerrit.cloudera.org:8080/#/c/24257/6/java/calcite-planner/src/main/java/org/apache/impala/calcite/rel/node/ImpalaJoinRel.java File java/calcite-planner/src/main/java/org/apache/impala/calcite/rel/node/ImpalaJoinRel.java: http://gerrit.cloudera.org:8080/#/c/24257/6/java/calcite-planner/src/main/java/org/apache/impala/calcite/rel/node/ImpalaJoinRel.java@113 PS6, Line 113: JoinNode.DistributionMode distMode = containsHint(SHUFFLE) Could we keep the same hint validation as `TableRef.analyzeJoinHints()`? `[broadcast, shuffle]` currently silently picks broadcast. `SHUFFLE` on a cross join and `BROADCAST` on right/full joins are also accepted and then ignored or overridden later. The classic planner returns an analysis error for these cases. The existing `TestJoinHints` cases look reusable here. -- To view, visit http://gerrit.cloudera.org:8080/24257 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Ie5a932cc09d3d370aa627228d0e226a92fa03168 Gerrit-Change-Number: 24257 Gerrit-PatchSet: 6 Gerrit-Owner: Steve Carlin <[email protected]> Gerrit-Reviewer: Aleksandr Efimov <[email protected]> Gerrit-Reviewer: Aman Sinha <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Reviewer: Jason Fehr <[email protected]> Gerrit-Reviewer: Joe McDonnell <[email protected]> Gerrit-Reviewer: Michael Smith <[email protected]> Gerrit-Reviewer: Quanlong Huang <[email protected]> Gerrit-Reviewer: Xuebin Su <[email protected]> Gerrit-Comment-Date: Thu, 06 Aug 2026 04:42:23 +0000 Gerrit-HasComments: Yes
