Repository navigation
Speed up safe DOUBLE-to-DECIMAL conversions - #31279
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? |
616c185 to
5ec04af
Compare
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 5ec04af100422fba0cef599fa9adbcc1c7bc45a8
Assessment: approve
Reviewed the complete four-file delta and affected callers. The conservative fast path belongs in the existing conversion owner, preserves rounding and error contracts, and provides substantial scalar savings. No actionable findings remain.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1
Validation:
-
Verified frozen HEAD, merge-base, clean source and diff checks. Reviewed rounding bounds, integral handling, overflow, signs, NULLs, cast diagnostics and test quality.
-
Frozen evidence records successful exact-head Ubuntu UT, coverage, arm64 SCA, shared build, proxy BVT and pessimistic multi-CN BVT.
-
Isolation preflight passed. A standalone probe using mechanically copied production arithmetic passed 450,385 finite input/scale comparisons against the base and an independent rational oracle. Receipt: checks/1793014104082171158-4.json; log: numerical-probe.log.
-
Five paired 200ms benchmark samples per group showed mixed-input median reductions of 55.5% for Decimal64 and 48.6% for Decimal128, with zero allocations. Fallback median changes ranged from -1.4% to +5.4%. Receipt: checks/1793014170865947153-3.json; log: benchmark-probe.log.
-
Source, extraction hashes, commands, exits and logs reconciled under /home/xupeng/.local/state/mo-bot/jobs/9a32eb49073a910122ac3da5/attempt-1. Final audit receipt: checks/1793014391925242976-4.json; details: review-notes.md and review-audit.json.
Limitations:
-
The standalone probe substitutes lightweight error constructors; it does not validate native package integration, SQL diagnostics or error-construction costs.
-
CI outcomes were accepted from the frozen evidence; raw remote test logs and author benchmark artifacts were not supplied. No new service run or query-throughput measurement was performed.
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
Adds reusable scalar/vector controls and a bounded SQL workload runner for the performance follow-up to merged #31191 and #31279. The original shortest-decimal rounding correction is preserved; this PR changes tests and measurement tools only. The runner verifies stored DOUBLE bit patterns, target metadata, runtime CAST plans and complete converted value distributions against an independent Decimal oracle. It covers five fallback classes, ordinary/exact-integer controls, both target sizes and high scales. Regression coverage adds subnormal boundaries, tiny runtime/NULL cases and DOUBLE rounding-overflow warnings. Original-head validation (`d92e7dc09b`) passed: both owning Go packages (including 5,679 rational-oracle cases), current-source vector benchmarks, incremental vet/lint, bounded-plan/output counterexamples and two 84-statement real-service BVT comparisons, the second including metadata. Original literals still return 1.01, 1.02 and -1.01. On the original source, a controlled C–A–A–C experiment compared current code with only #31279's fast path disabled: 16M stored rows per cohort, ten measured samples per side for scans and INSERT SELECT. On Apple M4 / darwin-arm64 / Go 1.27.1, current fallback-scan medians were roughly 0.43–0.71 s. Sample ranges overlapped and the same current binary's ordinary-scan arm medians drifted from 205 to 696 ms, so these measurements do not establish a stable query-throughput gain. Remaining formatting costs and measurement limits are explicit; scalar timings are not treated as query-performance approval. Reused evidence: [CI run 40371620171](https://github.com/matrixorigin/matrixone/actions/runs/40371620171) passed UT, SCA, coverage, both enabled BVT lanes and CI Required at `a718bfdf7f`. The [independent review](#31305 (review)) verified the scalar/vector controls and Python host probes at that same head. Historical service measurements above were not repeated. Manual branch refresh (`be4d060abb`, based on official main `7b80dbdbd3`) brings in the workflow updates that Mergify could not apply without workflow-write permission; it does not change Mergify permissions. All six PR files remain byte-identical to `a718bfdf7f`. Newly passed `.agents/skills/mo-dev/scripts/mo-cgo-test -short -p=2 -parallel=2 -v -count=1 -timeout=120s -run='^(TestCast|TestExplicitCastLexicalDecimalDiagnostics|TestExplicitCastLexicalStrictDMLEscalation)$' -bench='^BenchmarkFloatDecimalVectors$' -benchtime=1x ./pkg/sql/plan/function`: the three selected tests and all 38 vector branches (correctness smoke only). Diff, patch-equivalence and delivery-artifact checks passed. Types/native source inputs are unchanged across the base update; existing types evidence is reused. The local check retained pre-usearch-2.26.5 native libraries and does not validate HNSW or a fresh native generation. Full CI on the new base remains pending. Please have the reporter verify #31133 after merge. Approved by: @XuPeng-SH
## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: - #31133 ## What this PR does / why we need it: Removes shortest-value text formatting and reparsing from successful DOUBLE-to-DECIMAL64/128 fallback conversions. A private Go 1.27.1 numerical coefficient/exponent primitive preserves shortest-decimal rounding, the existing common-value shortcut, exact integral Decimal128 conversion and cast diagnostics. It includes a reproducible, attributed fixed power table. This follows merged #31191 (rounding correction), #31279 (common-value shortcut) and #31305 (coverage and measurement). The returned concern was remaining conversion work; the original rounding fix remains intact, including `CAST(1.005e0 AS DECIMAL(10,2)) = 1.01`. Existing error/retry formatting and Decimal256 conversion are unchanged. Validation: owning types/function tests, 137,168 shortest-pair checks, 5,719 rational rounding cases, scalar allocation checks, generator reproduction, incremental vet/lint, and two normal 89-statement real-service BVT runs, including metadata, strict rollback and prepared DOUBLE rebinding. Paired five-sample conversion benchmarks on Apple M4 / Go 1.27.1 reduce fallback scalar medians by 38–79% and vector medians by 35–76%, within control budgets and with zero scalar allocations. A bounded 16M-row A–B–B–A SQL experiment verified all outputs but showed substantial host drift; query throughput benefit remains undetermined. An initially slower integral INSERT control did not repeat in one bounded follow-up. Remote CI is pending. Please have the reporter verify #31133 after merge. CI repair validation (`470a2a0191f9f41ee9455e42a8f59e37e0e7165a`): preserves the Go-derived BSD headers and adds three exact license-eye path exclusions. Newly executed `license-eye -c .licenserc.yml header check` passed (6,983 files, zero invalid), `license-eye -c .licenserc.yml dep check` passed, and an unlicensed neighboring Go-file control was correctly rejected. Build and [coverage UT](https://github.com/matrixorigin/matrixone/actions/runs/40447443739/job/122002065623) results from `8467a69b316f16529042c211fb87a32f2220e57e` are reused because all executable sources, tests and build inputs are unchanged. Full SCA on this repair remains pending. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: XuPeng-SH <[email protected]>
What type of PR is this?
Which issue(s) this PR fixes:
What this PR does / why we need it:
This is a performance follow-up to merged #31191, which already corrected DOUBLE-to-DECIMAL rounding for #31133. The returned follow-up concerns the per-value formatting cost introduced by that fix. Results such as
CAST(1.005e0 AS DECIMAL(10,2)) = 1.01retain the corrected semantics.A conservative error bound lets common Decimal64/128 conversions skip shortest-decimal formatting when the rounded result is provably identical. Tie-adjacent, small, large and high-scale values retain the existing fallback. Exact integral Decimal128 conversion, width checks, signs and cast diagnostics are preserved.
Validation passed: both owning Go packages, an independent rational oracle covering 5,655 finite value/target combinations, real explicit/ordinary mixed-vector and overflow tests, zero-allocation checks, incremental vet/lint, and two real-service SQL probes with exact output and teardown comparisons. The probes cover literals, runtime columns, implicit INSERT, NULL, high-scale values, string controls and prepared parameters; they are not a full mo-tester BVT run.
Paired benchmarks used identical benchmark source, five 300 ms samples per group on Apple M4 / darwin-arm64 / Go 1.27.1. The existing fractional Decimal128 median fell from 34.45 to 7.16 ns/value; fixed mixed-input medians improved by 60.4% for Decimal64 and 54.3% for Decimal128. All samples had zero allocations. Fallback and integral controls met the design budgets, including one extended interleaved recheck of initially noisy high-scale results. These are scalar measurements; query throughput and cross-platform performance were not measured. Remote CI is pending.
Please have the reporter verify #31133 after merge.
Maintenance validation (2026-10-26): rebased onto official main
fbfba33b04ccfda3ca40815f2a9668e0da34ea0das5ec04af100422fba0cef599fa9adbcc1c7bc45a8to update the branch after Mergify reported missing fork-update permission.git range-diffconfirms the patch is unchanged; decimal/cast source, tests, Go dependencies and native inputs are identical to the prior head.git diff --checkand the Loom artifact check passed. The earlier validation summary above is retained; no product tests or benchmarks were rerun for this ancestry-only update. New-head CI remains pending.