Steve Carlin has posted comments on this change. ( http://gerrit.cloudera.org:8080/25077 )
Change subject: IMPALA-15530: Preserve Calcite expression labels ...................................................................... Patch Set 4: (5 comments) Cool, this is a nice addition! As you know, I'm working on getting the e2e tests to work when "fallback_planner=none". My hope is that this fix "re-fixes" some of the issues under $IMPALA_HOME/tests/shell (test_shell_commandline.py? test_shell_interactive.py?) Can you see if this causes any tests to fail in those python files when we run with Calcite planner? And if so, correct them in this patch? Thanks! http://gerrit.cloudera.org:8080/#/c/25077/4/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteParsedStatement.java File java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteParsedStatement.java: http://gerrit.cloudera.org:8080/#/c/25077/4/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteParsedStatement.java@66 PS4, Line 66: ImmutableMap.Builder<SqlParserPos, String> labels = ImmutableMap.builder(); optional personal nit: I kinda like the idea of keeping the constructor as small as possible? Can we put this for loop inside a private static method? http://gerrit.cloudera.org:8080/#/c/25077/4/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteRelNodeConverter.java File java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteRelNodeConverter.java: http://gerrit.cloudera.org:8080/#/c/25077/4/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteRelNodeConverter.java@226 PS4, Line 226: static List<SqlNode> getSelectItems(SqlNode node) { nit: Feels a bit awkward to me to have CalciteParsedStatement call this. I almost feel like this should be in CalciteParsedStatement and CalciteRelNodeConverter should call into CalciteParsedStatement.getSelectItems() http://gerrit.cloudera.org:8080/#/c/25077/4/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteRelNodeConverter.java@241 PS4, Line 241: static String getOriginalColumnLabel(SqlNode item, String sql) { I don't think this is called from CalciteRelNodeConverter, so we should probably move this into CalciteParsedStatement http://gerrit.cloudera.org:8080/#/c/25077/4/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteRelNodeConverter.java@243 PS4, Line 243: if (item.getKind() == SqlKind.AS || !alias.startsWith("EXPR$")) return alias; Can we put a comment here specifying that this is the more normal case, or be a little more verbose about when we see EXPR$? Or I almost have a preference for readability to structure this method as something like: return item.getKind() == SqlKind.AS || !alias.startsWith("EXPR$")) ? alias : createImpalaLabel(...); ...and put all the special case in a separate method. What do you think? http://gerrit.cloudera.org:8080/#/c/25077/4/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteRelNodeConverter.java@305 PS4, Line 305: return null; I didn't run this through, but if we are keeping the original, does this just mean that we can return "alias" here? Then we wouldn't have to worry about a null check and can also change the caller accordingly. -- To view, visit http://gerrit.cloudera.org:8080/25077 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I0e91b2ff8008513d0a097af806a2437ca725a542 Gerrit-Change-Number: 25077 Gerrit-PatchSet: 4 Gerrit-Owner: Aleksandr Efimov <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Reviewer: Michael Smith <[email protected]> Gerrit-Reviewer: Steve Carlin <[email protected]> Gerrit-Comment-Date: Wed, 28 Oct 2026 13:26:31 +0000 Gerrit-HasComments: Yes
