englefly opened a new pull request, #71073:
URL: https://github.com/apache/doris/pull/71073
### Background
Doris builds runtime filters from join build-side data and sends them to
probe-side scan operators. A shuffle exchange transfers blocks between
fragments and can queue blocks before downstream operators consume them.
### What problem does this PR solve?
Issue Number: None
Related PR: #70129 (superseded FE-only PR), #69844 (earlier approach)
PR Type: Feature
Problem Summary:
When a probe scan emits blocks before its runtime filter arrives, those
blocks can reach the join without being pruned. The opt-in session variable
`enable_runtime_filter_on_exchange` lets exchange receivers apply the same
filter when it is available, without waiting for it or changing scan wait
policy. Most of the diff is unit and regression coverage for planning, receiver
execution, and distributed publication. The feature is off by default.
### Details
- **Change map:** 14 files: production +187/-25, tests +852/-2, generated
regression output +199. Read the four commits in order:
1. FE target planning and input-slot binding in
`RuntimeFilterPushDownVisitor` and `RuntimeFilterTranslator` (+120/-14
production).
2. BE consumer registration without wait dependencies in
`RuntimeFilterConsumerHelper` (+21/-10 production).
3. Ready and late filter evaluation in `ExchangeSourceOperatorX` (+46/-1
production).
4. Distributed SQL regression and receiver profile checks (tests and
generated output only).
- **Scope:** Adds receiver targets to filters that already target scans,
including receivers that merge sorted inputs. Does not add exchange-only
filters, change local exchange operators, or change CTE sink filtering.
- **Design:** Record each receiver's probe expression during pushdown rather
than reconstructing it from the translated plan. Register receiver consumers
without a wait dependency so they can drain queued data. Apply filters after
the receiver's existing `LIMIT`/`OFFSET` selection and before projection, using
the receiver's input slots.
- **Usage:** Run `SET enable_runtime_filter_on_exchange = true;` in the
session before executing a join that has a scan runtime filter and a qualifying
exchange. `EXPLAIN` can show the extra receiver target; the Exchange section of
the runtime profile shows whether the receiver processed and filtered rows.
- **Default behavior:** `false`; existing scan filters and their wait
defaults remain in effect.
- **Compatibility:** Uses the existing runtime-filter descriptor and
publication protocol. No metadata, storage format, Thrift, or Protobuf changes.
Keep the flag disabled during rolling upgrades; older BEs do not apply receiver
targets, and mixed-version execution with the flag enabled was not verified.
### Testing
- The prior FE run reported 69 passing tests across
`RuntimeFilterExchangeTest`, `RuntimeFilterTranslatorBucketPruneTest`, and
`RuntimeFilterTest`, covering receiver targets, slot binding, pushdown
barriers, CTE handling, and the disabled default.
- The prior BE ASAN run reported 18 passing exchange and consumer-helper
tests, including ready and late filters, no-wait registration, merging,
pre-projection binding, `LIMIT`/`OFFSET`, and nullable probe keys.
- The pre-rebase `test_runtime_filter_on_exchange` regression passed on an
isolated cluster with two ASAN BEs (66 result groups). It checks result
equality with the feature on and off across four filter types, and checks
Exchange-scoped counters on delayed-build queries. In one run, a receiver
reported 2,667 filtered rows while the scan reported zero; SQL results matched.
### Notes for Reviewers
- CTE sink targets can share the receiver's plan ID but use different input
tuples. Keeping the sink path unchanged avoids replacing its target expression.
Receivers eliminated during translation are not targeted.
### Release note
Enable `enable_runtime_filter_on_exchange` to let shuffle exchange receivers
prune blocks with already-arrived join runtime filters. This does not add
receiver waits or change the existing scan wait policy. The setting defaults to
`false`.
### Check List (For Author)
- Behavior changed: No
- Does this need documentation: Yes (document the opt-in session variable
and Exchange profile counters in apache/doris-website before release)
- Pre-submission status: Partially verified: unit tests and the distributed
regression passed before the rebase; they were not rerun on the rebased head.
### AI Disclosure
- Tool: Codex
- Generated: BE implementation and tests, regression suite, and this
description.
- Human review: not stated
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]