Zoltan Borok-Nagy has posted comments on this change. ( 
https://gerrit.cloudera.org/25405 )

Change subject: IMPALA-15758: Allow early flushes in streaming preaggregations
......................................................................


Patch Set 2:

(6 comments)

Thanks for working on this!

https://gerrit.cloudera.org/#/c/25405/2//COMMIT_MSG
Commit Message:

https://gerrit.cloudera.org/#/c/25405/2//COMMIT_MSG@58
PS2, Line 58: Performance:
The numbers only cover cases where the flush helps. Could you add one where it 
shouldn't, e.g. preagg_bytes_limit, or grouping sets that all reduce about the 
same?


https://gerrit.cloudera.org/#/c/25405/2/be/src/exec/grouping-aggregator.h
File be/src/exec/grouping-aggregator.h:

https://gerrit.cloudera.org/#/c/25405/2/be/src/exec/grouping-aggregator.h@240
PS2, Line 240: ;
nit: could be const


https://gerrit.cloudera.org/#/c/25405/2/be/src/exec/grouping-aggregator.cc
File be/src/exec/grouping-aggregator.cc:

https://gerrit.cloudera.org/#/c/25405/2/be/src/exec/grouping-aggregator.cc@595
PS2, Line 595:       client->TransferReservationTo(dst->buffer_pool_client(), 
bytes, &transferred));
With preagg_bytes_limit the destination is starved because it's at its own max 
reservation, so TransferReservationTo() refuses the transfer. The victim still 
stops growing and gets flushed again: 64k buffers + preagg_bytes_limit=8m on 
lineitem gives 126-235 flushes per instance with FlushReservationReceived=0, 
and the destination passes the same rows through as without the flush. Maybe 
skip destinations without reservation headroom, or only stop the victim from 
growing when something was transferred?


https://gerrit.cloudera.org/#/c/25405/2/be/src/exec/streaming-aggregation-node.cc
File be/src/exec/streaming-aggregation-node.cc:

https://gerrit.cloudera.org/#/c/25405/2/be/src/exec/streaming-aggregation-node.cc@66
PS2, Line 66:       if (grouping_agg == nullptr) {
One NonGroupingAggregator turns flushing off for the whole node, e.g. 
count(distinct a), count(distinct b), sum(c) without GROUP BY. It holds no 
reservation, so wouldn't it be enough to skip it as victim and destination?


https://gerrit.cloudera.org/#/c/25405/2/be/src/exec/streaming-aggregation-node.cc@367
PS2, Line 367:     if (!dst->starved() || !dst->can_grow_hash_tables()) 
continue;
starved() stays true until the next flush, and window_passed() also counts rows 
passed through because ShouldExpandPreaggHashTables() said no. So an Aggregator 
that wouldn't grow its hash tables anyway can trigger a flush. Should the 
window only count rows passed through for lack of memory?


https://gerrit.cloudera.org/#/c/25405/2/be/src/exec/streaming-aggregation-node.cc@446
PS2, Line 446:   
RETURN_IF_ERROR(grouping_aggs_[flush_victim_idx_]->RestartAfterFlush(
Nothing starts a flush without a destination, so the flush_dst_idx_ < 0 path is 
unused. If it were used, ShouldExpandPreaggHashTables() would count the flushed 
groups in num_rows_returned_ while the new hash tables start empty, 
overestimating the reduction. Maybe drop this path?



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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I26e2a882c1831fcc903a39a3420dc09d79a318f8
Gerrit-Change-Number: 25405
Gerrit-PatchSet: 2
Gerrit-Owner: Yida Wu <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Zoltan Borok-Nagy <[email protected]>
Gerrit-Comment-Date: Sat, 14 Nov 2026 12:17:09 +0000
Gerrit-HasComments: Yes

Reply via email to