[fix](pipeline) Add streaming aggregation local exchange switch - #66222
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
|
/review |
TPC-H: Total hot run time: 29437 ms |
TPC-DS: Total hot run time: 177318 ms |
ClickBench: Total hot run time: 25.47 s |
There was a problem hiding this comment.
Request changes.
The dedicated option is wired through Thrift and BE safely, but two required execution paths are incomplete: default FE local-shuffle planning still uses the generic aggregation flag, and observer-to-master forwarding drops the new session value. The variable therefore does not reliably control streaming aggregation.
Critical checkpoint conclusions:
- Goal and proof: not achieved on the default FE-planned or forwarded-query paths; no new test proves either switch value.
- Scope and parallel paths: the four-file change is focused but omits the FE
AggregationNodeplanner path and forwarding metadata. - Concurrency and lifecycle: no new concurrency, lock, allocation, or lifecycle hazard was found.
StreamingAggOperatorX::init()rejects merge/finalize before distribution planning, so removing_needs_finalizefrom the early return is safe on reachable BE paths. - Conditions and data correctness: BE preserves hash-join passthrough, empty-key behavior, serial-child reshuffle behavior, grouping expressions, and the non-hash-child reshuffle guard. Final merge aggregation preserves rows; the defects are broken session semantics plus avoidable or suppressed local-exchange work.
- Configuration and compatibility: this is a per-query session variable. Thrift ID 228, the false default, BE
__isset, and rolling unknown-field behavior are compatible, but both FE and BE planner paths must consume the same setting and follower forwarding must preserve it. - Tests and results: no test file changed; existing coverage references only the old option, and the PR states tests were not run. Add direct BE branch tests, FE plan-shape/parity tests, and forwarding coverage.
- Observability, persistence, transactions, and writes: no new observability is required; reflective persistence and cloning are sound; no transaction, journal, or data-write behavior changes.
- User focus: no additional focus was provided; the whole PR was reviewed.
| tResult.setEnableDistinctStreamingAggregation(enableDistinctStreamingAggregation); | ||
| tResult.setEnableStreamingAggHashJoinForcePassthrough(enableStreamingAggHashJoinForcePassthrough); | ||
| tResult.setEnableLocalExchangeBeforeAgg(enableLocalExchangeBeforeAgg); | ||
| tResult.setEnableLocalExchangeBeforeStreamingAgg(enableLocalExchangeBeforeStreamingAgg); |
There was a problem hiding this comment.
[P1] Make the FE planner honor this dedicated switch
With enable_local_shuffle_planner=true (the default), NereidsPlanner inserts local exchanges in FE and RuntimeState::plan_local_shuffle() prevents BE from replanning them. AggregationNode.enforceAndDeriveLocalExchange() still gates the useStreamingPreagg branch on enableLocalExchangeBeforeAgg, so new=false/old=true still inserts a hash exchange and new=true/old=false suppresses it—the new variable has no effect on the default path. Please use enableLocalExchangeBeforeStreamingAgg in that branch, retain the old flag for the other aggregation operators, preserve the non-hash-child reshuffle invariant, and add opposite-value FE/BE planner tests plus direct BE branch coverage.
| @VarAttrDef.VarAttr(name = ENABLE_LOCAL_EXCHANGE_BEFORE_AGG, fuzzy = true) | ||
| public boolean enableLocalExchangeBeforeAgg = true; | ||
|
|
||
| @VarAttrDef.VarAttr(name = ENABLE_LOCAL_EXCHANGE_BEFORE_STREAMING_AGG, fuzzy = true) |
There was a problem hiding this comment.
[P1] Forward this query-affecting variable to the master
getForwardVariables() only includes fields marked needForward or one of the query-result-affect flags, and observer queries sent by FEOpExecutor are planned under a fresh master context. Because this annotation sets none of them, SET enable_local_exchange_before_streaming_agg=true on a follower is omitted and the master keeps false, so the knob silently changes behavior depending on the connected FE. Please add needForward=true and cover follower-to-master restoration.
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
FE Regression Coverage ReportIncrement line coverage |
What
Add
enable_local_exchange_before_streaming_agg, defaulting tofalse, and use it to control whether streaming aggregation requests a local hash exchange.Why
Using the generic aggregation switch changes streaming aggregation whenever it is enabled. A dedicated switch preserves the existing streaming aggregation distribution by default. The master-specific non-hash child distribution guard remains in place so grouping keys are reshuffled when required.
Validation