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

Change subject: IMPALA-14601: Support HBO for JoinNode cardinality
......................................................................


Patch Set 24:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/24426/24/fe/src/main/java/org/apache/impala/planner/ExprCanonicalizer.java
File fe/src/main/java/org/apache/impala/planner/ExprCanonicalizer.java:

http://gerrit.cloudera.org:8080/#/c/24426/24/fe/src/main/java/org/apache/impala/planner/ExprCanonicalizer.java@191
PS24, Line 191:     if (sourceExprs.size() != 1 || !(sourceExprs.get(0) 
instanceof SlotRef)) return null;
A materialized expression can lose its operand qualifiers here. `SortInfo` 
materializes function calls, so for a sort over a join `coalesce(a.id, 
b.int_col)` becomes a `SlotRef` whose single source is a `FunctionCallExpr`. 
`resolveOperandIndex()` stops at that source, while `SlotRef.toSql(FOR_HBO)` 
renders it without qualifying the nested slots. After substitution, both 
`coalesce(a.id, b.int_col)` and `coalesce(b.id, a.int_col)` can therefore 
render as `coalesce(id, int_col)` and share an HBO key.

This also makes the key phase-dependent: `SortNode` and `AnalyticEvalNode` 
first read HBO before their sort/order expressions are substituted, but store 
after substitution. Distributed planning recomputes `SortNode` after 
substitution, so the collided key can be read as well as stored.

Could we qualify the `SlotRef`s inside a single non-`SlotRef` source 
expression, or generate the key from stable original expressions? Please add 
swapped materialized `ORDER BY` tests for both `SortNode` and 
`AnalyticEvalNode`.



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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I70b655ae7027d0d9eb8e9fae9ba2e1b7ad9876b4
Gerrit-Change-Number: 24426
Gerrit-PatchSet: 24
Gerrit-Owner: Quanlong Huang <[email protected]>
Gerrit-Reviewer: Aleksandr Efimov <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Quanlong Huang <[email protected]>
Gerrit-Reviewer: Steve Carlin <[email protected]>
Gerrit-Comment-Date: Mon, 31 Aug 2026 17:02:07 +0000
Gerrit-HasComments: Yes

Reply via email to