Skip to content

fix(plan): preserve precision of decimal intermediates - #31034

Merged
XuPeng-SH merged 49 commits into
matrixorigin:mainfrom
aunjgr:fix/decimal-intermediate-precision
Oct 28, 2026
Merged

XuPeng-SH merged 49 commits into
matrixorigin:mainfrom
aunjgr:fix/decimal-intermediate-precision

Conversation

@aunjgr

@aunjgr aunjgr commented Oct 24, 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:

Related to #30840 and #30838.

What this PR does / why we need it:

Preserve logical decimal precision through physical coercion. DECIMAL(15,2) products use precision 30, and price * (1 - discount) uses DECIMAL(37,4), avoiding unnecessary Decimal256 execution. Addition/subtraction use integer digits, scale and carry; multiplication uses operand bounds while retaining existing scale rules. SUM retains its aggregate headroom and serialized state.

Keep the released checked Decimal128 multiplication route and implicit cast domains when nominal operand precisions fit 38 and only a legacy carrier envelope would promote the operation. Legacy D64/D128 precision-18/38 envelopes can retain 19-/39-digit signed coefficients; downstream inference reserves those bounds. Genuine wide domains and explicit Decimal256 remain wide. Untyped NULLs keep the released carrier rather than borrowing a numeric domain from their peer. BIGINT/UINT64/BIT retain Decimal128 inputs under the current strict integer-cast width contract.

Preserve column, explicit-cast and runtime-parameter domains during prepared rebinding. Reuse the existing original-expression binder input and already saved operands; construct shallow headers only for a real rebind and avoid duplicate recursive copies. Recover original TIME and integer lookup domains without moving casts into nested integer expressions. Reconstruct persisted CHECK/default/generated expressions across independent pre-width-check and strict-integer/pre-precision eras, including decimal-only products and rounding. Match complete trees, preserve candidate-work limits, and reject forged widths. Compose decimal precision with float-string catalog repair through origin matching, reconstruction and final rebinding, using independent mode bits. Keep folded defaults unchanged. Serialized protobuf fixtures authored by unmodified historical planners verify both DUMP and LOAD; normal execution and declared assignment checks retain their current policy. Reserve ROUND carries and negative CEIL/CEILING/FLOOR positions before inferring later arithmetic, including runtime positions and NULL/view/prepared consumers.

Align amd64 Go functions to 64 bytes to stabilize unchanged hot-loop cache-line offsets across unrelated code-size changes. Retain native/version flags in ordinary, prebuilt, Darwin and musl link paths. Other architectures keep their existing alignment. The native build owner regenerates the source-bound receipt; native library payloads are unchanged.

Validation: complete function/planner/Substrait owning suites, frontend and real MySQL prepared-TIME regressions, 42 complete SQL/JDBC fixtures (6,142 statements passed, 88 fixture-declared ignores, zero failures), and the full standard static gate. The isolated SF10 comparison uses unchanged Q1-Q22 SQL, excluded cold warmups, separate profiles, a verified 16 GiB CN cache and a 32 GiB whole-application cap. The measured precision change improves Q1 by 9.04% against ordinary main and 8.42% at fixed alignment; no query has a slower signal in any of the three controlled comparisons. Exact measured commits, per-query intervals and scalar tradeoffs are reported separately. TPC-H is the primary performance acceptance indicator.

CI follow-up

The coverage producer on ea4801b64e failed in TestIssue28012And28013AcceptedCommitDuringStandaloneShutdown; the coverage merge then lacked its prerequisite, so no coverage-rate verdict was calculated. The original assertion remains unconfirmed: artifact upload failed with ECONNRESET, the readable report retained only cleanup output, and local pre-fix reproduction passed.

The shutdown fixture now admits its independent control connection before the target transaction and fault barriers. Its unchanged ten-second deadline measures the control commit rather than connection authentication. The lease closes before cluster shutdown and has cleanup on early assertions. All real-commit, waiter, shutdown, restart-durability and follow-up-commit assertions remain intact. Other fixture corrections retain TERM acknowledgment before cancellation timing and an atomic UPDATE/INSERT in the fulltext snapshot case.

Merged authoritative main ea47345ff8 at head 4a2cc44044. The final owning package passes with dependency-wide set coverage, as do focused race and decimal/catalog regressions. The full repository pre-push gate passes with zero lint issues. Fresh CI must confirm recovery. Earlier isolated TPC-H results retain their original measured revisions; no fresh benchmark score is claimed here.

@aunjgr aunjgr added the severity/s0 Active / top priority for current sprint. Owner has committed to working on it now. label Oct 24, 2026
@aunjgr aunjgr self-assigned this Oct 24, 2026
@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 commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

Local SF10 acceptance for the decimal precision correction.

Benchmarked clean main 3878a13ef00fc85b1bced8a58a4f7d17df848806 versus isolated candidate 33b3299d3238a4f35107b9f331ae3f5aef366814. Final main refresh contains documentation/BVT only; executable-source evidence remains valid.

Independent ordinary clean-main/fix checkouts; only this unmerged fix; no source overlays. Six full-suite pairs with three warm calls; ten independent confirmation pairs with five calls; twenty Q11 resolution pairs with ten calls. Selected-query cold warmups excluded; profiles separate. All retained samples included; no geomean cancellation. Local SF10 only, not SF100 or mixed-I/O acceptance.

Every block accepted: zero measured physical I/O, spill, swap, OOM or sustained memory pressure; <=32GiB whole-application cap including private RAM image and pinned software; effective CN SHARED cache 16GiB; CPUs0-7, controller8-15.

Query Main median (s) Fix median (s) Paired change Paired ratio 95% interval Initial signal
Q1 1.4675 1.3546 -8.15% [0.9003, 0.9397] faster
Q2 0.0471 0.0457 -1.68% [0.9317, 1.0657] no_directional_signal
Q3 0.3990 0.3965 -2.60% [0.9558, 1.0008] no_directional_signal
Q4 0.3169 0.3173 -0.32% [0.9915, 1.0131] no_directional_signal
Q5 0.3772 0.3831 +0.82% [0.9778, 1.0354] no_directional_signal
Q6 0.2447 0.2439 +0.10% [0.9148, 1.0316] no_directional_signal
Q7 0.3613 0.3713 +2.11% [1.0073, 1.0594] slower
Q8 0.3501 0.3481 -2.40% [0.9665, 0.9957] faster
Q9 0.6876 0.6798 +0.08% [0.9523, 1.0156] no_directional_signal
Q10 0.5898 0.5844 -1.31% [0.9722, 1.0047] no_directional_signal
Q11 0.0900 0.0922 +1.39% [0.9974, 1.0431] no_directional_signal
Q12 0.4656 0.4533 -2.58% [0.9555, 1.0137] no_directional_signal
Q13 0.3415 0.3430 -0.65% [0.9842, 1.0327] no_directional_signal
Q14 0.2506 0.2470 -1.49% [0.9501, 1.0311] no_directional_signal
Q15 0.4541 0.4462 -2.06% [0.9515, 0.9987] faster
Q16 0.1300 0.1310 +0.07% [0.9824, 1.0306] no_directional_signal
Q17 0.3039 0.3054 -0.01% [0.9838, 1.0314] no_directional_signal
Q18 1.1122 1.1071 -1.26% [0.9504, 1.0059] no_directional_signal
Q19 0.6183 0.6163 -0.86% [0.9757, 1.0165] no_directional_signal
Q20 0.3693 0.3686 -0.61% [0.9764, 1.0081] no_directional_signal
Q21 1.4247 1.4205 -0.12% [0.9828, 1.0186] no_directional_signal
Q22 0.1123 0.1145 +2.10% [0.9738, 1.0593] no_directional_signal

A positive paired change means slower. Initial signals are preserved in the table; gains in other queries do not override them.

Q7’s initial slowdown did not reproduce in ten independent pairs: the confirmation estimate is −1.13% with its interval spanning equality. Q11 remained uncertain after the first confirmation, so a separate twenty-pair/ten-warm-call experiment was run. That estimate is +0.08%, interval [−0.37%, +0.56%]; all 36 retained Q11 pairs also have an interval spanning equality. No confirmed query regression remains under this local gate.

Confirmed query Independent paired change Independent ratio 95% interval All retained stratified ratio 95% interval
Q5 +0.28% [0.9878, 1.0151] [0.9933, 1.0136]
Q6 +0.12% [0.9634, 1.0288] [0.9634, 1.0247]
Q7 -1.13% [0.9744, 1.0056] [0.9887, 1.0179]
Q9 -0.50% [0.9710, 1.0029] [0.9715, 1.0029]
Q11 +0.08% [0.9963, 1.0056] [0.9995, 1.0147]
Q16 -0.66% [0.9546, 1.0263] [0.9745, 1.0155]
Q22 -0.39% [0.9743, 1.0174] [0.9760, 1.0270]

Separate CPU-counter diagnostics (not latency scoring):

Query Profile calls per version Main instructions/call Fix instructions/call Change
Q1 2 189534999599 175621878591 -7.34%
Q6 2 18171767182 18166486666 -0.03%
Q15 2 32919339039 32389225945 -1.61%
Q11 50 5484698397 5489040329 +0.08%

Functional validation: owning function/planner suites, real-service CTAS metadata/value/NULL/wide-product regression, and full repository static gate pass. Broader SF100 and mixed-I/O acceptance remains outside this PR’s local evidence and keeps #30840 open.

@matrix-meow matrix-meow added the size/M Denotes a PR that changes [100,499] lines label Oct 24, 2026
@mergify mergify Bot added the kind/bug Something isn't working label Oct 24, 2026

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

Request changes — one blocking item (stale BVT column-type headers)

Blocking: the declared numeric width is part of the BVT expected output (➤ col[type,width,scale]), and this change narrows those widths, but no existing .result file is updated. Reproduced on 79ad21e0da (binder → plan projection type):

BVT case recorded plan on this PR
test/distributed/cases/expression/case_when.result:252 (direct_mul, bug_case), :259 (bug_case_then), :294 (direct_mul) [3,38,7] DECIMAL128(29,7)
test/distributed/cases/dtype/time.result:199 t * 10 (t time(3)) [3,38,3] DECIMAL128(36,3)

Details, so this is reproducible rather than an assumption:

  • 7.01970 * cast(-58140.00 as decimal(23,2)) → operands DECIMAL64(6,5) + DECIMAL128(23,2) → p1+p2 = 29, scale 7. Both CASE variants merge to DECIMAL128(29,7).
  • t * 10 → the resolver receives [TIME(3), BIGINT] (no literal refinement here: hasDecimalInput == false), keeps the existing D64 MUL downcast (targets=[DECIMAL64 DECIMAL64]), so the result is 18 + 18 = 36. The recorded 38 is exactly what the removed parameters[0].Oid == T_decimal64 branch hard-coded — which also confirms the header carries the plan's declared width.

Not affected (checked, so the fix does not need to be wider than it is): dtype/timestamp.result:258 t * 10 stays 38,6; timestamp t + 1 stays 38,6; dtype/decimal.result cast(9223372.036854775808 as decimal(38)) + 1 stays 39; wide domains still use Decimal256 (decimal(38,0)+1 → DECIMAL256(39,0), decimal(38,0)*decimal(38,0) → DECIMAL256(65,0), and the full 76-digit product still raises out-of-range).

The CI BVT jobs did not reach the cases in this run (multi-CN compose did not become ready / no available CN server), so this is invisible in CI rather than green. Please run the full BVT and include the .result diff. My scan finds 22 result files / 119 decimal-typed expression headers containing arithmetic operators; I verified 5 header lines change — the remainder needs a re-run, not an assumption.

Non-blocking

  1. list_operator.go:185-198: the D64 MUL downcast emits DECIMAL64 cast targets whose Width comes from the integer domain, so a BIGINT operand becomes decimal64(19,0) while T_decimal64.ToType().Width == 18. Safe today (d64Mul accumulates in Decimal128, signedToDecimal64 ignores width; 9223372036854775807 * decimal(15,2) is exact), and it is the intended 19-digit decision — please state that next to the code (or clamp to 18) so a future int64-coefficient kernel cannot silently inherit it.
  2. list_operator.go:2210-2225: the older D64 downcast in the has branch is now shadowed for intN × D64 (18-based result 33 vs the new 19-based 34) and remains reachable only for peers without an exact-numeric domain (TIME/TIMESTAMP). Two encodings of one decision; consider giving it a single owner.
  3. list_operator.go:212,239: the ok returned by decimalArithmeticDomain is discarded, so a non-exact peer contributes width/scale 0. Unreachable today (the callers are guarded by parameters[0].Oid.IsDecimal()), but it silently yields a wrong envelope if that guard ever changes; prefer the historical-carrier fallback on !ok.
  4. base_binder.go:7343/7368: originalArgs ...[]*Expr silently ignores a second slice; a plain []*Expr is safer. :8162 &lookupTypes[0] == &argsType[0] is correct only because refineDecimalArithmeticLiteralLookupTypes copies on first change — that coupling deserves a comment, since in-place mutation would corrupt the argsType used further down the binder.
  5. Coverage: nothing pins the BIGINT operand domain change (legacy 18 → 19, result 33 → 34) at resolver level, only the final width; SUM/AVG metadata is only observable through constant-folded shapes (folded sum(dec(15,2)*dec(15,2)) = (52,4), folded to (39,4) by literal shrinking); a prepared-EXECUTE width case per operator would pin the "EXECUTE keeps its declared domain" rule.

What I verified positively

Clean worktree at 79ad21e0da, GOWORK=off -mod=readonly: pkg/sql/plan/function (2225 tests) and pkg/sql/plan (4155 tests) pass; the new tests pass; boundary values are exact — DECIMAL(15,2)^2 = 99999999999999800000000000.0001 at (30,4), DECIMAL(18,0)^2 at (36,0), DECIMAL(38,0)+DECIMAL(38,0) = 39 digits at (39,0), DECIMAL(38,38)+DECIMAL(38,38) at (39,38). The precision formulas match the physical kernel capability (p1+p2 <= 38 ⇒ int128 coefficient fits; add/sub bound covers scale alignment plus carry; width >= scale on every path, including the retained multiplication scale rule). I could not independently reproduce the SF10/SF100 numbers or the live-service regression from here.

@aunjgr

aunjgr commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

Current decimal-precision validation — measured 317c769e03, main 28e8760905

The current precision/build changes pass the complete SF10 query gate. Six balanced fresh-process triplets cover all six orders of ordinary main, main with 64-byte alignment, and this precision change with 64-byte alignment. Each process executes three scored warm calls per unchanged query. The cold warmup is excluded; twelve separate CPU profiles are excluded from latency scoring. Paired 95% intervals resample process blocks, not individual calls.

Q1 improves 9.04% against ordinary main (95% interval −9.66% to −7.55%) and 8.42% at fixed alignment (interval −9.89% to −6.39%). No query has a slower signal in any of the three contrasts; positive point estimates below are retained and are not described as improvements. No average is used to offset a regression.

Query Ordinary main, s Candidate, s Paired change Paired 95% interval
Q1 1.445703 1.319379 -9.04% [-9.66%, -7.55%]
Q2 0.049683 0.047213 -2.95% [-9.91%, +4.46%]
Q3 0.399940 0.396217 -1.95% [-4.97%, +1.96%]
Q4 0.317442 0.310807 -2.18% [-4.41%, +1.43%]
Q5 0.381863 0.386968 +1.20% [-1.98%, +5.10%]
Q6 0.241569 0.233700 -2.40% [-12.27%, +1.52%]
Q7 0.358166 0.357367 +1.03% [-4.10%, +2.75%]
Q8 0.349590 0.350341 +1.13% [-3.19%, +6.87%]
Q9 0.717143 0.701388 -1.48% [-4.94%, -0.09%]
Q10 0.581160 0.577792 +0.26% [-2.29%, +1.10%]
Q11 0.096094 0.090303 -5.97% [-11.20%, -2.51%]
Q12 0.458414 0.451899 -2.26% [-4.68%, +2.61%]
Q13 0.331002 0.331842 +0.66% [-2.84%, +1.95%]
Q14 0.249005 0.244803 -1.98% [-4.12%, -0.01%]
Q15 0.442778 0.442151 -0.60% [-4.29%, +2.82%]
Q16 0.131147 0.131310 -0.30% [-3.62%, +4.61%]
Q17 0.263371 0.266215 +1.19% [-2.01%, +3.46%]
Q18 1.078337 1.079742 +0.04% [-3.99%, +1.53%]
Q19 0.611906 0.612609 +0.36% [-3.15%, +2.88%]
Q20 0.365768 0.362594 -1.14% [-2.87%, +1.72%]
Q21 1.405987 1.382300 -1.72% [-2.63%, -0.98%]
Q22 0.112134 0.109799 -1.47% [-5.75%, -0.39%]

Resource protocol: 8 physical application cores (0–7), controller cores 8–15, the CN SHARED cache configured and observed at 16 GiB, 32 GiB for the entire application including its private RAM image and pinned engine/client/shared libraries, swap disabled, 2 GiB spill budget. All 30 accepted latency/profile windows have zero physical reads/writes, spill events, swap and OOM, and no sustained memory pressure. The largest conservative application footprint is 23.76 GiB. One earlier arm recorded 64 KiB reads: its entire matched triplet was excluded and repeated, with zero I/O in the replacement; no timing-based exclusions.

After freezing these measurements, I merged main ccfca4f7fd into 0801a8a52c. That main update changes TN append/catalog internals. All 47 files in this PR's measured change remain byte-identical; the functional owner suites and standard pre-push gate were rerun after integration. The performance numbers above identify their exact measured commits rather than claiming a new post-merge timing run.

Correctness: full function/planner/Substrait suites; frontend and the real MySQL prepared-TIME regression; 42 complete JDBC/SQL fixtures, 6,142 successful statements, 88 fixture-declared ignores, zero failures. Metadata comparisons remain enabled where the fixtures request them. Strict integer-to-decimal assignments remain intact; BIGINT inputs retain D128 casts, and persisted-origin verification has independent historical formulas. The checked legacy-D64 carry product is covered by an independent integer oracle and public SQL.

The DECIMAL(20,0) × DECIMAL(18,0) case now retains the released checked D128 route and released implicit cast domains instead of introducing two D256 casts. The maintained public binder/executor benchmark has 15 actual decimal-execution cases covering 1/256/8192 rows plus nullable, all-NULL and constant inputs. It performs no value verification. Current-main component measurements are reported below.

Evidence retained locally: build/pr31034-next-review/precision-main28-current/{source-audit.json,protocol.json,jobs.json,timing-analysis.json,verdict.json}; every arm includes completion, I/O/cache/cgroup/admission/build-monitor receipts, exact software identities, and (for CPU captures) perf.record plus perf.stat. Separate profiles cover Q1/Q4/Q17/Q21 for all three builds; profile timings never enter the table. Benchmark scripts inspect completion/resources and software/configuration identity only; they do not verify input tables, schemas, counts, checksums or query values.

Validation commands:

.agents/skills/mo-dev/scripts/mo-cgo-test -ldflags=-funcalign=64 -count=1 -timeout=180s ./pkg/sql/plan/function ./pkg/sql/plan ./pkg/sql/plan/substrait
~/.codex/skills/mo-pr-guard/scripts/check.sh --pre-push upstream/main

Current-main component controls (six balanced triplets, identical public fixture, first result per case/process discarded, 100ms scored duration):

Fixed-alignment comparison Main ns/op Candidate ns/op Paired change 95% interval
d15x15_rows1_flat 117.00 116.85 +1.61% [-3.12%, +4.70%]
d15x15_rows256_flat 616.40 612.45 -0.01% [-1.05%, +2.68%]
d15x15_rows8192_flat 16354.00 16434.50 -0.32% [-1.36%, +2.72%]
d20x17_rows1_flat 231.45 239.30 +3.13% [-4.18%, +7.42%]
d20x17_rows256_flat 1702.50 1714.50 +0.77% [-8.75%, +4.65%]
d20x17_rows8192_flat 43203.50 43552.50 +1.18% [-0.50%, +14.43%]
d20x18_rows1_flat 228.75 237.30 +3.60% [+3.13%, +24.63%]
d20x18_rows256_allnull 703.95 714.50 +1.21% [-0.66%, +5.62%]
d20x18_rows256_constant 1592.00 1593.00 +0.44% [-10.05%, +4.48%]
d20x18_rows256_flat 1703.00 1709.50 +0.26% [-8.89%, +0.88%]
d20x18_rows256_nullable 1871.50 1867.00 -0.11% [-7.09%, +3.97%]
d20x18_rows8192_flat 43101.50 43214.50 +0.16% [-0.30%, +13.63%]
d20x19_rows1_flat 266.25 265.40 -0.26% [-0.88%, +2.50%]
d20x19_rows256_flat 4345.50 4396.50 +1.10% [-0.64%, +2.87%]
d20x19_rows8192_flat 131546.50 131671.00 +0.10% [-0.11%, +0.68%]

All 15 cases retain their allocation counts and none has a confirmed batch slowdown. The single-row D20×D18 control is slower by about 8.6 ns/op in this run (paired +3.60%, interval +3.13% to +24.63%); this is disclosed as a scalar tradeoff under the requested TPC-H-first acceptance policy. Earlier longer confirmations showed roughly 3.6–3.9 ns scalar costs; the fresh short control has wider uncertainty. It does not introduce Decimal256 execution. The complete unchanged Q1–Q22 query comparison remains the primary indicator; no scalar or aggregate improvement offsets a material query/batch regression.

Current-main control artifacts: build/tpch-kernels-wave2/matched-pr31034-mainccf/{builds.json,current/analysis.json,current/samples.json,current/quality.json}. The candidate is the post-integration head 0801a8a52c; clean main is ccfca4f7fd. Both 32-byte/default and 64-byte/alignment controls are retained.

For completeness, every component contrast with an interval entirely above 1 is listed here (all are single-row controls):

Contrast Case Main/control ns Candidate ns Paired change 95% interval
alignment_only d20x19_rows1_flat 262.35 266.25 +1.56% [+1.10%, +1.66%]
precision_under_fixed_alignment d20x18_rows1_flat 228.75 237.30 +3.60% [+3.13%, +24.63%]
shipped_candidate d20x18_rows1_flat 232.40 237.30 +2.04% [+1.53%, +22.28%]
shipped_candidate d20x19_rows1_flat 262.35 265.40 +1.13% [+0.74%, +3.83%]

@XuPeng-SH

XuPeng-SH commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 0801a8a52c9742536173c1b9542589aaf1822244

Review completed. Read the assessment.

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

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

Commit: 0801a8a52c9742536173c1b9542589aaf1822244

Assessment: request_changes

Reviewed the complete 47-file delta and frozen discussion. Precision inference appropriately stays in the existing resolver without adding runtime machinery. Earlier TIME and rounding concerns are resolved, but persisted decimal-only expressions cannot reach the historical binding logic, breaking DUMP/LOAD compatibility. The author's compatibility explanation establishes that the historical formulas exist; the reproduction demonstrates that their selection remains incomplete.

Model: gpt-6-astra / xhigh

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

  • P1 pkg/sql/plan/function/legacy_integer_decimal.go:45: Create review_decimal(a decimal(15,2), b decimal(38,4), constraint ck check(a*a < b)) on the merge base, then verify its persisted catalog or backup on this candidate.
    Impact: DUMP and LOAD reject the valid expression with table dump cannot verify bound check expression ck. The new historical decimal-arithmetic support is gated by tableDumpHasIntegerDecimalCoercion, which only recognizes integer/BIT-to-decimal casts. Extend candidate selection to affected decimal-only expressions while preserving exact-tree verification and work limits.
    Evidence: Actual merge-base BuildPlan output was serialized and successfully self-verified. Candidate AnalyzeTableDumpBindings rejects it in both DUMP and LOAD modes; the selector returns false. Fresh-head expressions and unchanged addition controls pass. Explicitly selecting tableDumpBindingPreIntegerDecimal reproduces the exact historical tree. See table_dump_binding.go:284, :682 and :768; base-origin.log with checks/1793033004163144881-3.json; head-origin-confirm.log with checks/1793033118745382442-3.json. All artifacts are under the assigned attempt directory.

Validation:

  • Isolation preflight and repository-owned native builds passed for candidate and merge base; native provenance and artifact hashes reconciled.

  • Ten focused candidate planner tests passed, covering arithmetic domains, rounding boundaries, prepared expressions, CTAS metadata and existing persisted-decimal fixtures. Receipt: checks/1793032922919978739-3.json; log: head-focused.log.

  • Base-authored multiplication and nested-rounding fixtures reproduced six candidate DUMP/LOAD failures; addition controls passed. Probe versions, fixtures, source fingerprints and receipts are retained in validation-audit.json.

  • Saved discussion-assessment.json covering all 18 nonempty discussion items exactly once. Final audit passed with original source unchanged: checks/1793033462725218416-3.json and final-evidence-audit.log.

Limitations:

  • Reproduction executes the production binding verifier used by frontend DUMP/LOAD; complete SQL export/import commands were not run.

  • The latest author report addresses the earlier performance concern, reporting Q1 improvements of 9.04% versus ordinary main and 8.42% at fixed alignment, alongside an accepted 8.6 ns scalar cost. Raw performance artifacts were unavailable for independent reconciliation; postmerge performance equivalence remains unaudited.

  • Broader suites were not rerun. Frozen CI success is corroborating metadata, not independently inspected execution logs. The verdict rests on the confirmed compatibility regression.

@aunjgr

aunjgr commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

Resolve the persisted-decimal P1

The selector gap is fixed, including two additional classes reproduced with independently authored main trees: strict integer/decimal arithmetic and negative ROUND/CEIL/FLOOR metadata.

The verifier now selects a dedicated historical precision witness independently of pre-width-check integer coercions. The precision witness retains the already-released strict integer cast domains; the earlier integer-coercion witness also restores its historical precision. Decimal-only arithmetic and rounding can reach the appropriate complete-tree binder. Redundant combined eras are not generated, and ordinary integer-only defaults keep their existing candidate work.

Twelve complete protobuf fixtures were authored and self-verified by unmodified main 6c1942f3cf, then serialized without using the historical implementation under test. Nine cases failed before this fix. All twelve now pass both production DUMP and LOAD binding verification, including CHECK/default/generated columns, multiplication, nested rounding, negative rounding and mixed BIGINT arithmetic. The original catalog bytes remain unchanged. Forged product precisions 31/37 are rejected; the candidate-node limit still rejects excess work. An unchanged integer literal still fits exactly the two existing binding visits and fails with one.

Current execution retains corrected precision/rounding and strict declared casts. The added contexts are confined to origin verification; normal-resolution equality and integer-domain controls pass. Full function/planner/Substrait suites pass, and final native/current-main/static evidence is retained under build/pr31034-next-review/decimal-origin-*. No SQL backup/export end-to-end claim is made: the regression directly exercises the production verifier invoked by those paths.

The earlier detailed SF10 report remains the measured evidence for the arithmetic change, with its exact frozen commits and disclosed scalar costs. This verification fix does not change arithmetic kernels or layouts; no new-head timing measurement is claimed here.

@XuPeng-SH

XuPeng-SH commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 4a2cc440446bd87c7fcb68ad1bc239823edad8f7

Review completed. Read the assessment.

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

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

Commit: 4a2cc440446bd87c7fcb68ad1bc239823edad8f7

Assessment: approve

Prior blocking concerns are resolved. Decimal bounds, prepared metadata, historical catalog verification, and changed test lifecycles are covered. No actionable findings remain.

Model: gpt-6-astra / xhigh

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

Validation:

  • Full function, planner, and Substrait suites passed.

  • Frontend metadata and real MySQL prepared-statement checks passed.

  • Independent MySQL probe verified rounding compositions, exact values, precision, and NULL propagation.

  • Exact shutdown test passed normally, with dependency-wide coverage, and under race detection including two stress repetitions.

  • Cancellation fixture passed normally and under race detection, including 14 stress repetitions.

  • Isolation preflight, native provenance verification, formatting, diff checks, and scoped go vet passed.

  • All 15 receipts reconciled with retained logs in validation-manifest.json; all 22 discussion entries assessed. Source remains unchanged.

Limitations:

  • Eight unrelated ONNX tests skipped.

  • Performance assessment reuses prior evidence and its accepted scalar tradeoff; raw benchmark artifacts were unavailable and no fresh timing claim is made.

  • Full distributed BVT/JDBC, configured lint, and CI campaigns were not rerun. Broader linked-issue closure remains outside this assessment.

@mergify

mergify Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

🚫 Left the queue

1 h 9 min in the queue, with no time running CI.

So far

  • ✅ Entered the queue Wed 28 Oct, 11:30 · rule main · triggered by rule Automatic queue on approval for main
  • ⏹️ Testing stopped · in place
  • 🚫 Left the queue 12:38 · 0ff83ea

Reason

Pull request #31034 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.

The author needs to enable "Allow edits from maintainers" on this pull request.

Hint

You 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.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Merge conditions: 2 of 3 met

This pull request

Condition Required by
✅ #review-threads-unresolved = 0 GitHub branch protection
✅ github-review-approved GitHub branch protection

The batch, tested in place

Condition Required by
❌ any of: check-neutral = CI Required, check-skipped = CI Required, check-success = CI Required GitHub branch protection

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

Times in UTC · dashboard · how the merge queue works

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

dequeued kind/bug Something isn't working severity/s0 Active / top priority for current sprint. Owner has committed to working on it now. size/XL Denotes a PR that changes [1000, 1999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants