Skip to content

fix(plan): avoid shuffle for replace capture dedup join - #24502

Merged
mergify[bot] merged 3 commits into
matrixorigin:mainfrom
ck89119:issue-24472
May 20, 2026
Merged

fix(plan): avoid shuffle for replace capture dedup join#24502
mergify[bot] merged 3 commits into
matrixorigin:mainfrom
ck89119:issue-24472

Conversation

@ck89119

@ck89119 ck89119 commented May 20, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #24472

What this PR does / why we need it:

REPLACE INTO ... SELECT ... FROM can build a DEDUP join with OldColCaptureList on the merged main-table scan path. For large source scans, the planner could still mark that DEDUP join as shuffle, but the compile layer does not support shuffle DEDUP joins with old-column capture and fails with:

shuffle DedupJoin with OldColCapture is not supported

This PR disables shuffle planning for DEDUP joins that carry DedupJoinCtx.OldColCaptureList, keeping those REPLACE plans on the supported non-shuffle capture path. The existing OldColList guard is preserved.

Tests added:

  • cover plain large DEDUP joins still being eligible for shuffle
  • cover OldColList and OldColCaptureList disabling shuffle
  • cover the actual REPLACE merged-scan plan shape so capture DEDUP joins do not become shuffle plans

Validation:

  • go test ./pkg/sql/plan -run 'TestReplaceCaptureList|TestReplaceCaptureDedupJoinDoesNotShuffle|TestDetermineShuffleForDedupJoin' -count=1\n- go test ./pkg/sql/plan -count=1\n- git diff --check\n- make\n- make static-check

@ck89119
ck89119 requested review from aunjgr and ouyuanning as code owners May 20, 2026 08:53
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@aunjgr aunjgr 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.

Review: disable shuffle for OldColCapture dedup joins

Approve.

No blocking issues found. The change correctly prevents DEDUP joins with OldColCaptureList from being planned as shuffle joins, avoiding the unsupported compile path that would panic for shuffle OldColCapture dedup joins.

The added tests cover both the generic dedup shuffle decision and the actual REPLACE capture-plan shape with large build-side stats.

@mergify mergify Bot added the queued label May 20, 2026
@mergify

mergify Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-05-20 14:39 UTC · Rule: main
  • Checks passed · in-place
  • Merged2026-05-20 15:42 UTC · at 54f9ca8003feedc00c8f1e71ff231c6e48c4faff · squash

This pull request spent 1 hour 2 minutes 13 seconds in the queue, including 1 hour 58 seconds running CI.

Required conditions to merge
  • #approved-reviews-by >= 1 [🛡 GitHub branch protection]
  • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-decision = APPROVED [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-neutral = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-skipped = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / SCA Test on Ubuntu/x86
    • check-neutral = Matrixone CI / SCA Test on Ubuntu/x86
    • check-skipped = Matrixone CI / SCA Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(Optimistic/PUSH)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(Optimistic/PUSH)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(Optimistic/PUSH)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Upgrade CI / Compatibility Test With Target on Linux/x64(LAUNCH)
    • check-neutral = Matrixone Upgrade CI / Compatibility Test With Target on Linux/x64(LAUNCH)
    • check-skipped = Matrixone Upgrade CI / Compatibility Test With Target on Linux/x64(LAUNCH)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Utils CI / Coverage
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage

@mergify
mergify Bot merged commit 726bf23 into matrixorigin:main May 20, 2026
23 of 24 checks passed
@mergify mergify Bot removed the queued label May 20, 2026
@ck89119
ck89119 deleted the issue-24472 branch May 21, 2026 02:51
mergify Bot pushed a commit that referenced this pull request May 25, 2026
…to 4.0-dev) (#24518)

Cherry-pick #24502 to `4.0-dev`.

`REPLACE INTO ... SELECT ... FROM` can build a DEDUP join with `OldColCaptureList` on the merged main-table scan path. For large source scans, the planner could still mark that DEDUP join as shuffle, but the compile layer does not support shuffle DEDUP joins with old-column capture and fails with:

```text
shuffle DedupJoin with OldColCapture is not supported
```

This PR disables shuffle planning for DEDUP joins that carry `DedupJoinCtx.OldColCaptureList`, keeping those REPLACE plans on the supported non-shuffle capture path. The existing `OldColList` guard is preserved.

Cherry-picked commit:

- 66f9089 `fix(plan): avoid shuffle for replace capture dedup join`

Validation:

- Not run locally for this cherry-pick PR.

Approved by: @aunjgr, @XuPeng-SH
ULookup pushed a commit to ULookup/matrixone that referenced this pull request May 26, 2026
…#24502)

`REPLACE INTO ... SELECT ... FROM` can build a DEDUP join with `OldColCaptureList` on the merged main-table scan path. For large source scans, the planner could still mark that DEDUP join as shuffle, but the compile layer does not support shuffle DEDUP joins with old-column capture and fails with:

```text
shuffle DedupJoin with OldColCapture is not supported
```

This PR disables shuffle planning for DEDUP joins that carry `DedupJoinCtx.OldColCaptureList`, keeping those REPLACE plans on the supported non-shuffle capture path. The existing `OldColList` guard is preserved.

Tests added:

- cover plain large DEDUP joins still being eligible for shuffle
- cover `OldColList` and `OldColCaptureList` disabling shuffle
- cover the actual REPLACE merged-scan plan shape so capture DEDUP joins do not become shuffle plans

Validation:

- `go test ./pkg/sql/plan -run 'TestReplaceCaptureList|TestReplaceCaptureDedupJoinDoesNotShuffle|TestDetermineShuffleForDedupJoin' -count=1`\n- `go test ./pkg/sql/plan -count=1`\n- `git diff --check`\n- `make`\n- `make static-check`

Approved by: @aunjgr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants