Repository navigation
fix: widen decimal SUM accumulation - #28624
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
APPROVE at d0f3347 against main e2580f9. Both previously reported rolling-upgrade blockers are closed; no new concrete blocker found.
The final-result fix is on the worker, not merely on the upgraded coordinator: decodeScope installs RemoteRunContext on both process contexts and restores the serialized NeedEval flag. Group.Prepare now selects legacyDecimalSumResult for remote final Groups below v65. The wide Decimal64/Decimal128 legacy constructors then retain their physical Decimal128 return type and do not enable widening. This closes the old-coordinator -> new-worker value-1 counterexample even though that coordinator never runs the new shuffle gate. A new coordinator still disables affected final shuffle below v65 and its local MergeGroup explicitly keeps legacyDecimalSumResult=false, widening the compatible partial accumulator to its own planned Decimal256 result. At v65 the widened representation is enabled normally.
Revalidated the bidirectional pre-v65 [Decimal128 sum, int64 count] state selection, constructor flag propagation, ordinary/DISTINCT/null Flush paths and allocation-error ownership, precision headroom/cap, AVG state separation, window behavior, metadata changes and Substrait eligibility fallback. Mixed-version operation intentionally retains old accumulator range until the common protocol advances. Widening has bounded per-group state/output cost; the 12 TPC-H Substrait exclusions are an explicit offload/performance tradeoff, not silently successful exports.
Evidence: complete current 19-file change map and review/comment history, direct tracing of remote decode -> Prepare -> legacy constructor -> Flush, and inspection of TestRemoteFinalDecimalSumPreservesOldCoordinatorResult (both input widths, v64/v65, actual Group execution/value/type), bidirectional state tests and compiler gate controls. The six core SUM/Group files are byte-identical to those independently reviewed earlier in the integrated #28540 head c824051, so that analysis remains valid. Reused the author's reported owning-package, focused race and build results; I did not rerun native suites, deploy a mixed-CN cluster, benchmark, or wait for CI. Live head/base were rechecked unchanged before submission.
…6-widen # Conflicts: # pkg/defines/const.go
…6-widen # Conflicts: # pkg/defines/const.go # pkg/sql/colexec/group/group_test.go
aptend
left a comment
There was a problem hiding this comment.
Re-reviewed the complete diff, all reviews, inline replies and resolved thread state, and the delta since my prior review at bfe9669 against exact head 5b644f8. Both rolling-upgrade blockers are closed. Below the current v67 gate, partial Group and coordinator MergeGroup select the same legacy two-vector Decimal128 state; a remotely decoded final Group also preserves the old coordinator Decimal128 result, while an upgraded local finalizer converts the compatible accumulator to its planned Decimal256 output. At v67 the widened one-vector state and result are enabled together. I also traced ordinary, DISTINCT, null, window, spill/rebuild and allocation-error paths, the precision cap, shuffle fallback, and the explicit Substrait eligibility tradeoff; no new blocking issue found. Exact-head required CI, Ubuntu UT, SCA, coverage and exercised BVT jobs are terminal-success. Static diff and formatting checks are clean; I reused exact-head CI and the prior focused compatibility/race evidence rather than rebuilding native dependencies locally.
…6-widen # Conflicts: # pkg/defines/const.go # pkg/sql/colexec/group/exec2.go # pkg/sql/colexec/group/mergeGroup.go # pkg/sql/colexec/group/types2.go
…6-widen # Conflicts: # pkg/defines/const.go
|
Resolved the latest main conflict in eaed65e by merging upstream/main at 07fdd4a. Main now owns MORPC v68 for complete strict-write GROUP_CONCAT cut reporting, so widened DECIMAL SUM moves to v69. I updated both producer/coordinator gates and the old/new wire-compatibility tests to preserve the pre-v69 layout during mixed-version operation. Local validation passed for aggexec, group, window, compile, substrait, and process, followed by make build. Fresh CI is expected from this push. |
…6-widen # Conflicts: # pkg/defines/const.go
|
Resolved the latest main conflict in cf0d541 by merging upstream/main at f9a4444. Main owns MORPC v69 for exact bounded per-partition RANK with boundary ties, so widened DECIMAL SUM now uses v70. I updated the protocol constant, remote producer/coordinator gates, legacy result handling, and old/new wire-compatibility tests; the main RANK v69 path remains unchanged. Local validation passed for aggexec, group, window, partition, hashjoin, compile, plan, plan/function, substrait, process, and fulltext2, followed by make build. Fresh CI is expected from this push. |
…6-widen # Conflicts: # pkg/defines/const.go
|
Resolved the latest main conflict at dd52272 after preserving the remote branch updates and merging upstream/main through 2ea4ec2. Main now owns MORPC v69-v72. Widened DECIMAL SUM therefore moves to v73, with the producer, coordinator, legacy result handling, and old/new wire-compatibility tests updated together. Local aggregate/group/window/compile/plan/substrait/process regression tests passed, followed by the complete native-provenance-aware make build. |
aunjgr
left a comment
There was a problem hiding this comment.
Re-reviewed exact head dd52272 against base 2ea4ec2. Our prior unversioned SUM partial-state blocker is closed.
The v73 boundary now selects the legacy [Decimal128 sum, int64 count] state for both partial Group and coordinator MergeGroup below the boundary. An upgraded local finalizer widens that compatible accumulator to its planned Decimal256 output; a remotely decoded final Group instead preserves an old coordinator's Decimal128 result contract. I traced RemoteRunContext/NeedEval restoration, constructor flags, ordinary/DISTINCT Flush, partial-result cleanup, and the shuffle gate. The bidirectional value-1 tests and remote-final Group tests cover both Decimal64 and Decimal128 inputs.
Same-version widened accumulation and precision headroom remain intact; mixed-version mode intentionally retains the old accumulator range. Main currently ends at v72, so v73 is a fresh allocation. #28540 contains the same core SUM implementation and must follow this PR.
No remaining confirmed blocker. Reused green current-head CI, earlier source review, and revision-scoped independent compatibility evidence; no new native build, SQL server or mixed-CN deployment run. The twelve TPC-H Substrait exclusions remain an explicit offload tradeoff, not a claim of all-22 offload compatibility.
Merge Queue Status
This pull request spent 1 hour 33 minutes 52 seconds in the queue, with no time running CI. Waiting for any of
All conditions
ReasonThe merge conditions cannot be satisfied due to failing checks
HintYou may have to fix your CI before adding the pull request to the queue again. Requeued — the merge queue status continues in this comment ↓. |
|
Follow-up on the Ubuntu/x86 UT failure: run attempt 2 produced no failed test assertion. The PR was behind main. I merged current
|
Merge Queue Status
This pull request spent 50 minutes in the queue, with no time running CI. Waiting for any of
All conditions
ReasonPull request #28624 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Tick the box to put this pull request back in the merge queue (same as
|
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #28585
What this PR does / why we need it:
[Decimal128 sum, int64 count]layout on both remote partial and coordinator MergeGroup while a cluster has mixed protocol versions; a new coordinator converts the compatible legacy state to its planned Decimal256 result.main.Testing
go test ./pkg/sql/colexec/aggexec ./pkg/sql/colexec/group ./pkg/sql/colexec/window ./pkg/sql/colexec/partition ./pkg/sql/colexec/hashjoin ./pkg/sql/compile ./pkg/sql/plan ./pkg/sql/plan/function ./pkg/sql/plan/substrait ./pkg/vm/process ./pkg/fulltext2 -count=1make build