Steve Carlin has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/23516 )

Change subject: IMPALA-14405: Labels for Calcite expressions not matching 
original planner
......................................................................


Patch Set 2:

(3 comments)

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

http://gerrit.cloudera.org:8080/#/c/23516/2//COMMIT_MSG@18
PS2, Line 18: modulei
> nit: typo 'modulei' .  Also, test suites are you referring to that contain
Fixed the typo.

Also added the python file that tests these issues


http://gerrit.cloudera.org:8080/#/c/23516/2/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/23516/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteRelNodeConverter.java@179
PS2, Line 179:       if (fieldName.startsWith("EXPR$")) {
> One of the pros of the EXPR$ label is that it generates unique names.
Added a test with duplicate expressions.

I tested the original planner, and it looks like something else kicks in when a 
CTAS is done.  The statement

"create table test_labels as select 1, 1"

...produces a table with column names _c0 and _c1.  There must be a different 
mechanism that kicks in for CTAS. When we support CTAS, we can look at this


http://gerrit.cloudera.org:8080/#/c/23516/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteRelNodeConverter.java@184
PS2, Line 184:        fieldName = 
selectItem.toSqlString(PostgresqlSqlDialect.DEFAULT).getSql();
             :       }
             :       fieldNamesBuilder.add(fieldName.toLowerCase(
> These 2 things seem important :  the use of Postgres dialect to get the fie
Yeah, this caused a bit of concern for me. This is a hard thing to test, 
because most common expressions will be the same across all databases. To be 
honest, I just picked Postgres because I realize it is used in many places and 
it was the first one that came to mind.

In terms of lowercase, if I do a "select length('hello')" where the output will 
have the function name, they do indeed match.

Maybe it would make more sense to use MySql?



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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ibd3e6366a284f53807b4b2c42efafa279249c1ea
Gerrit-Change-Number: 23516
Gerrit-PatchSet: 2
Gerrit-Owner: Steve Carlin <[email protected]>
Gerrit-Reviewer: Aman Sinha <[email protected]>
Gerrit-Reviewer: Fang-Yu Rao <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Joe McDonnell <[email protected]>
Gerrit-Reviewer: Michael Smith <[email protected]>
Gerrit-Reviewer: Riza Suminto <[email protected]>
Gerrit-Reviewer: Steve Carlin <[email protected]>
Gerrit-Comment-Date: Thu, 16 Oct 2025 14:25:54 +0000
Gerrit-HasComments: Yes

Reply via email to