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


Change subject: PROTOTYPE: Merge cross-joined scalar aggregates over the same 
input
......................................................................

PROTOTYPE: Merge cross-joined scalar aggregates over the same input

TPC-DS q9, q28 and q88 cross-join 5-8 scalar aggregates over
store_sales (joined with the same dimensions in q88) that differ only
in their filters. Each one becomes a separate full scan of the fact
table, and all scans compete for the same cores.

MergeScalarAggregates runs right after the expand step. It merges such
aggregates into one aggregate over the shared input: the input is
filtered on the common conjuncts AND the OR of the specific ones, and
each aggregate gets CASE WHEN <its filter> THEN x END as its argument.
That is equivalent for COUNT, SUM, AVG, MIN and MAX, which ignore
NULLs. The per-column hull of the branches' range bounds is added as
plain conjuncts, so the scan can use them.

Testing:
- TPC-DS SF3000, 8 executors, MT_DOP=8, PLANNER=CALCITE,
  CTE_THRESHOLD=1: q9 15.4 s -> 6.3 s, q28 21.0 s -> 9.9 s, q88
  31.3 s -> 4.7 s, results matched. No new tests.

Change-Id: I08ba9fdbb80d5e638807a8f42622d1af3aa22941
Assisted-by: Claude Opus 5.5 (Claude Code)
---
A 
java/calcite-planner/src/main/java/org/apache/impala/calcite/rules/MergeScalarAggregates.java
M 
java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteOptimizer.java
2 files changed, 473 insertions(+), 0 deletions(-)



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

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

Reply via email to