Quanlong Huang has posted comments on this change. ( 
https://gerrit.cloudera.org/24612 )

Change subject: IMPALA-15179: Support HBO for SelectNode cardinality
......................................................................


Patch Set 13:

(2 comments)

https://gerrit.cloudera.org/#/c/24612/12//COMMIT_MSG
Commit Message:

https://gerrit.cloudera.org/#/c/24612/12//COMMIT_MSG@9
PS12, Line 9: evaluated
> nit: evaluated
Done


https://gerrit.cloudera.org/#/c/24612/12/fe/src/main/java/org/apache/impala/planner/SelectNode.java
File fe/src/main/java/org/apache/impala/planner/SelectNode.java:

https://gerrit.cloudera.org/#/c/24612/12/fe/src/main/java/org/apache/impala/planner/SelectNode.java@127
PS12, Line 127:     tryUpdateCardinalityFromHbo(analyzer);
> I see that SelectNode has a private field selectivity_ .  When the cardinal
That's a good point. selectivity_ is only used in computeSelectivity(). For 
SelectNode, it's only used in computeStats() on L123 when the child also has a 
valid cardinality. If we update selectivity_, it's possible that next time when 
computeStats() is invoked it's stale but still be used. Here is a possible 
sequence:

- computeStats() updates selectivity_ from -1 to a value computed based on HBO 
cardinality.
- Planner adds some conjuncts to this SelectNode or changes its subtree.
- computeStats() is invoked again. The plan changes make HBO stats no longer 
hit. The stale selectivity_ is used to compute the new cardinality_.

Based on this, I think it's safer to not set selectivity_ here. Otherwise, we 
might need to reset it to -1 whenever the plan changes.



--
To view, visit https://gerrit.cloudera.org/24612
To unsubscribe, visit https://gerrit.cloudera.org/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I5804f9ebf9e06a4947ea3e11441c63e89c82e036
Gerrit-Change-Number: 24612
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: Fri, 13 Nov 2026 12:45:25 +0000
Gerrit-HasComments: Yes

Reply via email to