Skip to content

branch-4.2: [opt](local shuffle) support bucket shuffle for set operation #65129 - #68188

Closed
924060929 wants to merge 1 commit into
auto-pick-65348-branch-4.2from
auto-pick-65129-branch-4.2
Closed

924060929 wants to merge 1 commit into
auto-pick-65348-branch-4.2from
auto-pick-65129-branch-4.2

Conversation

@924060929

Copy link
Copy Markdown
Contributor

Cherry-picked from #65129

@924060929
924060929 requested a review from yiguolei as a code owner September 18, 2026 09:29
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@924060929

Copy link
Copy Markdown
Contributor Author

run buildall

@924060929

Copy link
Copy Markdown
Contributor Author

/review

@924060929

Copy link
Copy Markdown
Contributor Author

Superseded by #68199, which backports the whole local shuffle series as one PR.

@924060929 924060929 closed this Sep 18, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static review completed against ba53396 across all 12 changed files and the surrounding optimizer-property, memo, translation, local-exchange, distributed-scheduling, and BE sender paths. I found two correctness issues: (1) the optimizer and translator disagree for enable_local_shuffle=false with enable_local_shuffle_planner=false, allowing bucket-shuffle sinks while omitting the marker needed to fill missing-bucket receivers; and (2) set-operation derivation can cache a specific layout on one equivalent output position while its children were aligned on another, allowing later exact-property memo reuse to reconstruct stale child mappings and skip a required re-key. No existing inline review covered either issue at the final duplicate check. Per the review constraints, this was static-only; no builds or tests were run. Note: the PR was closed as superseded by #68199 while this review was in progress; these findings apply to the exact head above and should also be checked wherever this change is carried forward.

// children arrive (bucket-shuffle exchanges). Both routes converge to the same
// bucket-hash local exchange requirement in SetOperationNode.enforceAndDeriveLocalExchange.
if (context.getSessionVariable() != null
&& context.getSessionVariable().isEnableLocalShufflePlanner()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setOperationBucketShuffleAllowed() permits bucket-shuffled set operations when enable_local_shuffle=false even if enable_local_shuffle_planner=false, but this guard leaves the translated node unmarked. With a bucket-pruned UNION (or right/later-basic EXCEPT), UnassignedScanBucketOlapTableJob.shouldFillUpInstances() then skips missing-bucket receivers because it recognizes the set operation only through isBucketShuffle(). The exchange still targets those bucket indexes, whose dummy destinations discard rows. Please derive the marker from the actual storage-bucketed plan/the same eligibility predicate and add a false/false/true result case.

}
// check whether the set operation output all distribution columns of the child
if (setOperationDistributeColumnIds.size() == orderedShuffledColumns.size()) {
// Keep the basic child's specific storage layout as the set operation output. When

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the basic child's bucket key is directly exposed at output 0 but equivalent to output 1, a parent request on output 1 makes the regulator align the other set-operation arms on output 1. This fast path nevertheless records a specific NATURAL(output[0]) property. calculateEnforce() caches that exact property with the output-1 child requirements before adding the immediate corrective exchange; if another join-order alternative later requires output 0, the equal-cost correct entry does not replace the stale child list because updateLowestCostTable() only replaces on lower cost. A parent can then select exact NATURAL(output[0]), and chooseBestPlan() reconstructs children still hashed on output 1, which is wrong for UNION arms where the two values differ. Please derive or validate the same ordered output-position mapping across every child instead of returning from the basic child's direct ExprIds alone, and add a memo-reuse result case with unequal sibling columns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants