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

   ### Background
   
   Each shuffle hash join build contributes keys to its global runtime filters. 
The build task publishes its contribution when it closes, after synchronizing 
filter sizes when required. The merge node combines these contributions for 
runtime filter consumers across the query.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: #49837 (disabled filters on early termination), #55942 (runtime 
filter size reporting on early termination), #71073 (workload investigation and 
original copy of this fix)
   PR Type: Bugfix
   
   Problem Summary:
   
   In TPC-DS 10 TB Q58 on 16 BEs, an empty build partition sometimes disabled a 
global runtime filter even when other partitions had keys to contribute. An 
empty build can let its local inner join probe close before the build publishes 
its filter. The completed build should publish an empty contribution so the 
merge still includes keys from the other partitions.
   
   ### Details
   
   - **Frequency:** Intermittent. It depends on whether the local probe closes 
after Build EOS and before normal filter publication.
   - **Root cause:** `Pipeline::make_all_runnable()` wakes build tasks early 
when the downstream pipeline closes. For a completed build whose filter is 
still pending, this releases the finish dependency and leads the sink to call 
`skip_process()`. One disabled contribution disables the merged filter.
   - **Why existing tests missed it:** `PipelineTest.PLAN_HASH_JOIN` closed 
each build normally. The `check_rf` SQL regression verifies planned filter 
placement through `EXPLAIN` and does not exercise this build and probe timing.
   - **Fix:** Mark builds with filters as needing to finish after downstream 
close once they consume EOS, before releasing the probe. Their normal finish 
dependency allows size synchronization and filter publication to complete. 
Incomplete builds and query cancellation can still take their existing 
early-exit paths.
   - **Other paths and branches:** In-memory partitioned hash joins share the 
inner build's finish dependency and receive the fix. Spilled builds retain 
their existing filter handling. The same termination path was found in the 
checked 4.0, 4.1, and 4.2 refs.
   - **Behavior change:** A completed empty partition can contribute an empty 
filter instead of disabling the global filter.
   
   ### Testing
   
   The three changed BE implementation files and the updated unit test compiled 
to ASAN objects locally. Clang-format 16, BE build hygiene, and changed-line 
clang-tidy checks passed. The clang-tidy run disabled the Clang Static Analyzer.
   
   `PipelineTest.PLAN_HASH_JOIN` now delivers a downstream close after Build 
EOS while the RF finish dependency is pending. The assertions check that the 
dependency stays pending, the build is not marked for early wake-up, and normal 
close publishes a ready filter. The complete test executable was not linked 
locally, so the assertions and a new distributed Q58 run remain unverified.
   
   ### Release note
   
   Shuffle hash joins preserve global runtime filtering when a completed empty 
build partition lets its local probe finish early.
   
   ### Check List (For Author)
   
   - Behavior changed: Yes (see Details)
   - Does this need documentation: No
   - Pre-submission status: Partially verified: ASAN unit-test execution, full 
static analysis, and a distributed Q58 rerun are pending.
   
   ### AI Disclosure
   
   - Tool: Codex
   - Generated: BE fix, pipeline unit-test assertions, 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]

Reply via email to