Skip to content

fix(shuffle): preserve unsigned range routing with NULLs on 4.1.6 hotfix - #31115

Merged
XuPeng-SH merged 1 commit into
4.1.6-hotfixfrom
codex/hotfix416-unsigned-null-range
Oct 25, 2026
Merged

XuPeng-SH merged 1 commit into
4.1.6-hotfixfrom
codex/hotfix416-unsigned-null-range

Conversation

@XuPeng-SH

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:

Fixes #31114

What this PR does / why we need it:

V1 Range Shuffle on 4.1.6-hotfix converts nullable UINT64 keys to INT64 in the min/max fallback. Keys at or above 2^63 can therefore reach different buckets depending on whether their input batch contains NULL, violating equal-key partitioning for shuffle joins and aggregation.

Use the existing unsigned helper, matching the non-null/expression paths and main/4.2-dev. NULL continues to use bucket 0. The correction adds no branches, state, allocations, or extra passes. This PR is independent of #30977, which covers ShuffleV2.

Validation: the regression fails before the fix and passes afterward. Full pkg/sql/colexec/shuffle tests pass with -count=1 and -race -count=1 on macOS arm64 / Go 1.26.4. Incremental gofmt, molint/vet and configured golangci-lint v2.6.2 pass (0 issues). Coverage includes actual NULL/no-NULL/all-NULL batches, reused selection buffers, 2^63/MaxUint64 and explicit-range controls. The confirmed reproduction is at the real operator boundary; no end-to-end SQL wrong-result reproduction is claimed. Remote CI is pending.

@XuPeng-SH
XuPeng-SH requested a review from aunjgr as a code owner October 25, 2026 13:42
@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 →

@XuPeng-SH

XuPeng-SH commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: a1746fe9476336fd6129c06f1b9d7ef59827bbeb

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mo-bot review · mo-bot-local · review

Commit: a1746fe9476336fd6129c06f1b9d7ef59827bbeb

Assessment: approve

Reviewed the complete two-file delta and affected callers. Reusing the existing unsigned helper correctly restores UINT64 bucket consistency across nullable and non-null batches while preserving NULL routing. The fix adds no state, allocation, traversal or I/O; broader routing changes are unnecessary. Regression coverage is meaningful, and no actionable findings remain.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1

Validation:

  • Full shuffle package passed on Linux/amd64 with Go 1.26.4, -vet=all, -count=1 and the supplied test-exec: eight top-level tests, including all eight new regression phases; no skips.

  • Test execution is supported by shuffle-package-test.log and checks/1792936633234865214-3.json, with exit 0 and the exact clean HEAD.

  • Isolation preflight passed. Native prerequisites were built through the repository Makefiles from 165 verified frozen inputs; provenance is retained in native-inputs.json and native-provenance.json.

  • Reviewed join/group callers, sorted/constant/expression paths, NULL handling, selection reuse and lifecycle behavior. No technical review comments were present.

  • Diff whitespace check passed and source remained unchanged. Commands, fingerprints, exits and log hashes are reconciled in /home/xupeng/.local/state/mo-bot/jobs/f32da0ccf3e78e27a86ef341/attempt-1/validation-audit.json.

Limitations:

  • No end-to-end SQL reproduction, local race run or performance benchmark was performed. CI remained in progress when inspected.

  • Full linked-issue text and raw author race/lint logs were not supplied; acceptance uses the PR-described contract, source review and independently executed package tests.

@XuPeng-SH
XuPeng-SH merged commit 5b5c0ad into 4.1.6-hotfix Oct 25, 2026
32 of 34 checks passed
@XuPeng-SH
XuPeng-SH deleted the codex/hotfix416-unsigned-null-range branch October 25, 2026 14:24
XuPeng-SH added a commit that referenced this pull request Oct 25, 2026
…30977)

## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [x] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Related to matrixorigin/matrixflow#19631 and #25687.

## What this PR does / why we need it:

Covering-index rewriting can replace a selected shuffle column with
`serial_extract(...)` after Range Shuffle has been chosen. On
`4.1.6-hotfix`, aggregation constructors dereference a missing column
reference and ShuffleV2 rejects Range expressions. Preserve the selected
expression and its output type in JOIN/GROUP V1/V2 construction, then
route evaluated vectors through the existing Range implementation
without replacing input vectors or changing pool ownership.

Use unsigned arithmetic in the shared nullable uint64 min/max router so
high-bit keys retain the same bucket with or without NULLs.
Column/expression/serial_extract tests check high-bit and maximum uint64
values, NULL placement, clamping, exact row ownership, vector identity
and cleanup.

For empty remote dispatch, atomically claim a UUID and enqueue its
receiver under the registration lock. Reset closes registration, drains
queued receivers and owns terminal delivery. A healthy notification
first handled after 30 seconds still consumes the existing completion
tombstone and receives normal End; empty EOS no longer waits for it.
Capture the original cancellation function before publication, clean up
partially registered dispatches before failed startup returns, and
retain the existing nonempty-data and missing-producer bounds. No
wire-format change or additional worker/retry is introduced.

The Compose MinIO fixture explicitly selects amd64, propagates
bucket-setup errors and tolerates an existing bucket. The latest target
`4.1.6-hotfix@9cdcce5` is merged, retaining its disconnect/export
fixes, independent V1 uint64 correction (#31115) and exclusive
relation-handle backport (#31116), without duplicating those changes in
this PR. No planner strategy or pool implementation is replaced.

### Validation

Current review-fix validation uses Go 1.26.4 on macOS/arm64 with
matching native libraries:

- Full colexec, dispatch, shuffle, shuffleV2 and compile packages pass
normally and under race on the merged head. Unfiltered configured
golangci-lint **v2.6.2**, vet, gofmt, diff-check, err-check and license
checks pass.
- Deterministic registry/Dispatch/real-handler tests cover late lookup
at 60 seconds of virtual time, early/mixed notification, original
errors, query cancellation, disconnected transport, bounded nonempty
waits, registration rollback and generation reuse. Six focused lifecycle
tests pass **100 race iterations each**; changed-block coverage is
**65/65 statements (100%)**.
- Restoring only the old EOS wait reproduces the late healthy failure;
restoring only the old Reset reproduces missing terminal delivery for an
already-published receiver. Both counterexamples fail on their intended
assertions.
- `TestCoveringIndexShuffleSQL` passes all four query shapes on one and
three CNs under `-race -short -tags=matrixone_test`, including after
target integration. The prepared UPDATE JOIN second-execute race
regression also passes on that integrated target. Counts remain **270002
/ 134102 / 134100**.
- Unchanged SQL/result fixtures pass normal mo-tester comparison twice:
**27/27**, zero ignored/abnormal cases, verified schema teardown and
service health; the task-owned instance is stopped.

Earlier Linux/amd64 evidence at `45cfcd3f21` remains applicable to the
unchanged expression/routing contracts. Its three full-compile Parquet
fanout failures were reproduced on clean target `d315e9c993` in that
environment; no Parquet assertion was changed. The focused/macOS results
above do not establish full-repository Linux CI success.

---------

Co-authored-by: XuPeng-SH <[email protected]>

This branch was previously deployed

1 inactive deployment
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/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants