Zoltan Borok-Nagy has uploaded this change for review. ( 
http://gerrit.cloudera.org:8080/25068


Change subject: PROTOTYPE IMPALA-15520: Cap join NDVs by rows surviving FK/PK 
joins
......................................................................

PROTOTYPE IMPALA-15520: Cap join NDVs by rows surviving FK/PK joins

The N:M join estimate divides by the larger join-column NDV, which
comes from the base table. In TPC-DS q72, d2.d_week_seq keeps its
10,642 NDV although only the 261 date_dim rows that match
inv_date_sk survive an earlier FK/PK join, so join 14 is
underestimated 40x and the inventory side ends up on the build side
of a huge partitioned join.

For an inner or left outer FK/PK join with tuple T on the PK side, at
most NDV(FK) distinct T rows (the product of NDVs for a multi-column
key) reach the join's output. getMaxDistinctRows() finds the smallest
such bound in a join input, and the generic join estimate caps the
adjusted NDV of a T column at it. This only lowers NDVs, so it can
only raise estimates.

Alone, this raises q72's per-host memory estimate from 7.09 GB to
197 GB, because the selectivity of non-equi join conjuncts is ignored.
It needs IMPALA-8262.

Testing:
- TPC-DS SF100, 5 executors, MT_DOP=0: q72 99 s -> 19 s, total -26%.
  Results matched master, except q56 and q65, whose LIMIT ties vary
  between runs. Planner test expectations are not updated.

Change-Id: Icb7fbd20a907d88edc8b549037a3cba569cb5978
Assisted-by: Claude Opus 5.5 (Claude Code)
---
M fe/src/main/java/org/apache/impala/planner/JoinNode.java
1 file changed, 76 insertions(+), 1 deletion(-)



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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icb7fbd20a907d88edc8b549037a3cba569cb5978
Gerrit-Change-Number: 25068
Gerrit-PatchSet: 1
Gerrit-Owner: Zoltan Borok-Nagy <[email protected]>

Reply via email to