mrhhsg opened a new pull request, #71454:
URL: https://github.com/apache/doris/pull/71454

   ### Background
   
   Runtime filters built by hash joins reduce scan input. Broadcast hash joins 
give each local producer a complete filter, either from replicated build input 
or from the shared hash-table builder's wrapper. Scan consumers register with 
either an instance-local manager or a query-level merger.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: #70661 (establishes private merger-wrapper ownership)
   PR Type: Performance
   
   Problem Summary:
   
   Local broadcast joins can unnecessarily copy and merge the same complete 
runtime filter when serial scans or local exchanges require query-level 
registration. After local exchange planning, this PR proves target-instance 
coverage and reroutes eligible consumers to instance-local managers. Results 
remain unchanged; unproven layouts retain their original route. Most changed 
lines are tests.
   
   ### Details
   
   - **Change map:** 142 changed production lines across seven files, 563 
changed test-code lines, and 535 generated expected-output lines. Production 
changes add read-only operator metadata, final-layout routing, and a producer 
marker preserving the existing left-semi optimization boundary.
   - **Why it was slow:** Query-level registration makes each local producer 
enter the merger even when its broadcast payload is already complete. The 
merger clones the first payload, unions subsequent payloads, and waits for all 
producers.
   - **Optimization:** Before parallel task preparation, check the complete 
target map against actual producer and scan instance prefixes, using the same 
instance-count helper as task creation. Only fully covered, previously merged 
local broadcast filters qualify. Reuse the existing publication path and retain 
all producer and LocalMergeContext registrations. A registration-time marker 
prevents rerouting from enabling additional left-semi direct-return cases.
   - **Results:** With 100,000 probe rows, 1,000 build keys, four tasks and a 1 
MiB Bloom filter, the targeted serial-scan case changed from four merge calls 
and one wrapper clone to zero of either, with the filter still APPLIED under 
both local exchange planners. A separate, uninstrumented RELEASE comparison 
used one BE on the same shared x86_64 Xeon Platinum 8457C host, four tasks, 10 
million probe rows, 1 million sparse build keys, hash-table sharing, a fixed 16 
MiB Bloom filter, and disabled SQL/query caches. Each case had two warmups and 
eleven measured end-to-end samples.
   
     | Scenario | Before p50 | After p50 |
     |---|---:|---:|
     | Serial probe scan requiring local merge | 114.970 ms | 103.486 ms |
     | Already-direct parallel scan control | 80.036 ms | 79.239 ms |
   
     All samples returned identical results. These were sequential measurements 
on a shared host with overlapping latency ranges, not a general 10% latency 
guarantee; the control's approximately 1% difference is close to noise.
   
   - **Applicability and cost:** Only proven local-only broadcast scan targets 
are rerouted. Remote targets, shuffle joins, recursive fragments, missing or 
unsupported targets, and insufficient instance coverage retain the existing 
path. Already-direct filters are unchanged. The added cost is a prepare-time 
metadata walk and a small eligible-ID set, not per-row work. No configuration, 
wire field, storage format, or global merger ownership rule changes.
   
   ### Testing
   
   Local validation:
   
   - BE ASAN and RELEASE builds: `./build.sh --be -j 48`; FE packaging and 
Checkstyle: `./build.sh --fe -j 48`, using a writable local dependency cache.
   - `./run-be-ut.sh --run -j 48 
'--filter=LocalBroadcastRuntimeFilterRoutingTest.*:RuntimeFilterProducerTest.*:RuntimeFilterProducerHelperTest.*:RuntimeFilterMergerTest.*:RuntimeFilterMgrTest.*:RuntimeFilterWrapperTest.*:PipelineTest.*'`:
 89 tests across seven suites passed. The direct-publish UT fails with the 
original consumer registration and passes with this change.
   - `local_broadcast_rf_direct_publish`: 97 ordered checks passed against 
baseline-generated output and an independent relational oracle. Covers sharing, 
RF OFF/IN/Bloom, both exchange planners, scan parallelism, parallel 
preparation, join edge cases and shuffle fallback.
   - Existing `rf_bucket_pruning`, `test_local_shuffle_fe_be_consistency` and 
`test_local_shuffle_recursive_cte` suites passed. The recursive suite has RF 
OFF and validates layout, not recursive RF publication.
   - clang-format v16, format checking, build-header hygiene and diff checks 
passed. The RELEASE BE ELF audit found no GLIBC requirement newer than 2.17.
   
   ### Notes for Reviewers
   
   The bypass marker only preserves left-semi eligibility. Publication still 
checks actual query-level consumer registrations.
   
   ### Release note
   
   Reduce runtime filter copy, merge and wait overhead for local broadcast hash 
joins with complete target-instance coverage.
   
   ### Check List (For Author)
   
   - Behavior changed: No
   - Does this need documentation: No
   - Pre-submission status: Partially verified: multi-BE, mixed-version, 
cancellation stress and recursive RF round-trip execution were not exercised.
   
   ### AI Disclosure
   
   - Tool: Codex
   - Generated: Implementation, tests and this description.
   - Human review: Not yet performed.


-- 
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]

Reply via email to