branch-4.0: [fix](coordinator) fix computeDestIdToInstanceId picking wrong ExchangeNode for multi-input fragments #63615#63819
Open
github-actions[bot] wants to merge 2 commits into
Open
Conversation
…geNode for multi-input fragments (#63615) ## Proposed changes Fix `Rows mismatched! Data may be lost` error when a fragment receives data from multiple ExchangeNode inputs with different partition types (e.g. NLJ with HASH-partitioned probe + BROADCAST build). ### Root cause `ThriftPlansBuilder.filterInstancesWhichReceiveDataFromRemote` used `.iterator().next()` to pick the first input ExchangeNode. The iteration order over a `Set<Entry>` is non-deterministic. When it happens to pick the BROADCAST input (1 destination per BE), `shuffle_idx_to_instance_idx` has only 1 entry, while the HASH LOCAL_EXCHANGE expects N entries (one per pipeline task). Most hash partition indices find no mapping, and BE reports the error. Reproduction: a CTE query with `MultiCastDataSinks` sending UNPARTITIONED (to a BROADCAST build) and HASH_PARTITIONED (to an INNER JOIN build) into the same scan-free fragment. The bug is non-deterministic because it depends on Set iteration order. ### Fix Iterate all input exchanges and select the one with the most destinations on the target worker. This correctly identifies the main data-carrying (HASH-partitioned) exchange, ensuring the map is complete.
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
|
run buildall |
Contributor
|
run buildall |
Contributor
FE UT Coverage ReportIncrement line coverage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-picked from #63615