Aleksandr Efimov has uploaded this change for review. ( 
http://gerrit.cloudera.org:8080/24781


Change subject: IMPALA-15312: Say when HBO changed a join's build side
......................................................................

IMPALA-15312: Say when HBO changed a join's build side

IMPALA-15236 puts the provenance of an HBO cardinality next to the
number: the strategy that matched, the hash key, the estimate the planner
computed itself and the ratio between the two. That says where the number
came from, not whether it changed anything.

Join inversion is where the two come apart. Planner.invertJoins() weighs
the two inputs by cardinality, row size and parallelism, so a corrected
estimate can flip the verdict while the shape of the plan, its operator
counts and its node ids all stay put. On an outer-join-heavy report this
turned sixty joins from RIGHT OUTER back to LEFT OUTER, and comparing the
two plans by operator counts called them identical.

Run the same cost model a second time on the estimates the planner
computed for the two inputs, and record the outcome on the join when the
verdicts differ. At EXTENDED and above the join then prints

  HBO chose the build side: without it this join would have been inverted

The comparison is local. A match further down the tree is already folded
into both numbers, so this answers "did the substitution on an input
decide this", not "would the plan differ under use_hbo_stats=false" - the
second question needs a second planning pass, which is more than a detail
line is worth.

Testing:
- New HboJoinInversionTest, three cases: no match leaves no note; a
  seeded match that removes an inversion is recorded and printed; the
  line stays out of the default explain level. The history is seeded
  directly, so the tests do not depend on an earlier run.

Change-Id: Ifc9517936c3f93865917a5f3fa3924c641374fcd
Assisted-by: claude-opus-5 (Claude Code)
---
M fe/src/main/java/org/apache/impala/planner/JoinNode.java
M fe/src/main/java/org/apache/impala/planner/PlanNode.java
M fe/src/main/java/org/apache/impala/planner/Planner.java
A fe/src/test/java/org/apache/impala/planner/HboJoinInversionTest.java
4 files changed, 262 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/81/24781/1
--
To view, visit http://gerrit.cloudera.org:8080/24781
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifc9517936c3f93865917a5f3fa3924c641374fcd
Gerrit-Change-Number: 24781
Gerrit-PatchSet: 1
Gerrit-Owner: Aleksandr Efimov <[email protected]>

Reply via email to