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

Change subject: IMPALA-15127: Support HBO for UnionNode cardinality
......................................................................


Patch Set 13:

(1 comment)

Checked PS13: the empty-scan-stats handling is consistent end to end now; 
resolved those threads. Found one new issue in the constRows key generation, 
see the inline comment.

http://gerrit.cloudera.org:8080/#/c/24556/13/fe/src/main/java/org/apache/impala/planner/UnionNode.java
File fe/src/main/java/org/apache/impala/planner/UnionNode.java:

http://gerrit.cloudera.org:8080/#/c/24556/13/fe/src/main/java/org/apache/impala/planner/UnionNode.java@381
PS13, Line 381:                       .map(c -> 
ExprCanonicalizer.canonicalizeLiteral((LiteralExpr) c))
constExprLists_ isn't guaranteed to contain only LiteralExprs, so this cast can 
throw ClassCastException and fail planning when HBO is enabled.

createUnionPlan() adds the result exprs of any no-FROM operand without a 
constness check, and FoldConstantsRule skips non-constant exprs, so `select 
rand() union all select id from functional.alltypes` puts a FunctionCallExpr 
into constExprLists_. Generating this union's key (its own 
populateHboThriftFields(), or an ancestor's key via the operand list) then 
throws. With enable_expr_rewrites=false even `select 1 + 1 union all select 2` 
hits it, since nothing folds 1+1 into a literal.

Could we check instanceof and return null for non-literal rows (skip HBO for 
the subtree), or render them with toSql()? A regression test with a 
nondeterministic operand like rand() would pin this down.



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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ie228f530bdcb171d3b717966673164bf9a4c45c8
Gerrit-Change-Number: 24556
Gerrit-PatchSet: 13
Gerrit-Owner: Quanlong Huang <[email protected]>
Gerrit-Reviewer: Aleksandr Efimov <[email protected]>
Gerrit-Reviewer: Aman Sinha <[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, 17 Aug 2026 07:35:00 +0000
Gerrit-HasComments: Yes

Reply via email to