Skip to content

fix: consolidate decimal expression contracts and historical bug regressions - #29618

Merged
XuPeng-SH merged 28 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/quality-29249-20261003
Oct 5, 2026
Merged

XuPeng-SH merged 28 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/quality-29249-20261003

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Oct 5, 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:

Fixes #29614
Fixes #29615
Fixes #29610
Related to #29249

What this PR does / why we need it:

Ownership and fixes

  • Reuse existing unsigned decimal arithmetic and rescale owners. Fix full-width rounded division and declared precision checks at minimum signed magnitude.
  • Close empty widening-batch and parameter-conversion reuse contracts. Admit the cached parameter type and shape before decoding; NULL→value transitions reuse the existing conversion owner and leave rejected wrappers unchanged.
  • Share unary selection admission across 18 existing owners: inactive rows must not invoke conversion callbacks; preserve NULL, row-error and historical binary-prefix behavior.
  • Consolidate division/modulo/CAST regression families with independent literal values, exact errors, full type metadata, masks, reuse and cleanup assertions.
  • Replace unnecessary disk fixtures with existing MemoryFS fixtures, remove expected-vector allocations, and close owned planner/executor FileServices.
  • Correct the timestamp test oracle for historical DST, date rollover and fractional-hour offsets; reproduce the old failure on clean main.

Change scope

27 commits through bfe160c692, based on main 37ba071297.
Production: 6 files, +335/-492. Tests: 24 files, +2540/-3881.
Documentation: 2 design/evidence files, +295. Total: 32 files, net -1203 lines.
The review follow-up consolidates obsolete stage logs while preserving design contracts and test-retirement maps.
Old-to-retained contract mappings and staged gpt-6.1-sol xhigh reviews are recorded separately from line counts.

Validation

  • Function package: normal 10,449 nodes; race 10,448 nodes, all pass. The difference is one existing allocation-specific test excluded under race.

  • Types/vector: normal and race each cover 985/556 nodes. Types evidence is reused with unchanged inputs; vector and the five affected planner/executor race roots (28 nodes) were rerun after the follow-up. Prepared-prefix specialization covers another 25 nodes in each mode.

  • Focused owner regressions and private mutations reject incorrect errors, metadata, mask behavior and old unary execution. Final unary regression rejects 53 assertion nodes under the old owners.

  • Incremental vet and configured lint pass. Molint has two function-package and 11 supplementary-package diagnostics, verified against the main baseline; no new diagnostics are claimed.

  • Eight alternating pairs measure local test-family and representative owner costs. Template-result fixture family wall/CPU/bytes/allocations decrease about 49%/46%/15%/16%; representative unary owners show no material measured regression. These are local measurements, not CI or SQL throughput claims.

  • Current-head decimal_256_literal service BVT: two consecutive runs on one isolated instance, each 46/46 passed, zero failures/ignored/abnormal. SQL teardown has zero catalog residue; service close, admission release and port release pass. The four added SQL checks cover [Bug]: Decimal256 arithmetic precision guard lets MinInt256 escape the declared SQL domain #29615’s exact -2^255 coefficient, the first rejected and last valid precision-65 coefficients, and typed NULL recovery. This is focused BVT, not the full distributed suite.

  • Follow-up QA: converted D64/F32/F64 constant/flat NULL→value→changed value→NULL recovery, nullable rows, native D128 reuse controls, and both operands through real plusFn with exact values/types and pool cleanup.

  • Final design and overall review: gpt-6.1-sol / xhigh, APPROVE at bfe160c692; no unresolved material blockers. Both deep-review findings are closed.

Remaining limits

Current-head focused BVT is complete. Internal API mask/binary-vector counterexamples are not claimed as externally reachable SQL failures. Traced prepared-prefix producers preserve constant parameters and historical binary admission. Additional findings have local issue drafts; this PR does not claim to fix every historical issue in the conversation.

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

Deep review completed for 37ba0712974d4a1ebe3fe8cd8e6a4daba7400f5e → bfe160c692c30f4451bdfe8fe09aeeed46558fb5.

Conclusion: no confirmed actionable defects or remaining code-review blockers; recommend approval.

  • Design and ownership: decimal rescaling, parameter conversion and row selection reuse existing owners. Superseded division wrappers and duplicate rounding paths are removed. No additional state machine or parallel execution path is introduced.
  • Correctness and unhappy paths: the converted scalar NULL-to-value reuse panic is fixed by checking type and shape before decoding. Rejected reuse preserves the old wrapper. Tests cover both arithmetic operands, NULL transitions, empty batches, selected rows, error recovery and resource cleanup. The signed-minimum precision boundary now has actual service-level BVT coverage with invalid, adjacent valid and NULL controls.
  • Implementation, tests and documentation: reviewed separately across all 32 changed files. Removed tests map to retained behavioral coverage; independent coefficient/value, metadata, NULL and lifecycle assertions remain. No new overall query-throughput or whole-CI resource-saving claim is established by this review.

Validation evidence was reused after verifying that all 32 reviewed file hashes and the base still match:

  • Independent math/big CAST oracle: 3,240 executions passed, including 672 expected precision errors, covering six CAST routes, both signs, constant/ordinary vectors, NULL and chunk/rounding boundaries.
  • Types normal/race: 985 passing nodes each; vector normal/race: 556 each; function normal/race: 10,449/10,448. The difference is an existing allocation test excluded under race. Affected executor/planner race: 28; focused reuse regressions: 17.
  • Actual service decimal BVT: 46/46 twice on the same instance, with zero catalog residue and successful teardown.
  • Vet and configured incremental lint passed for five affected packages; configured lint reported zero issues. The 13 molint diagnostics match the baseline.

The earlier two local review findings are closed. At the comment check there were no submitted human reviews or inline comments; the sole issue comment was a Qodo service-paused notice. The evidence above establishes the reviewed local scope; repository-wide CI completion remains a separate check.

@XuPeng-SH
XuPeng-SH merged commit 856e9dd into matrixorigin:main Oct 5, 2026
@XuPeng-SH
XuPeng-SH deleted the codex/quality-29249-20261003 branch October 5, 2026 06:00

This branch was previously deployed

1 inactive deployment
ci — d76e3ad2 Deployed Oct 5, 2026 by XuPeng-SH
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 kind/enhancement kind/refactor Code refactor kind/test-ci size/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

2 participants