Skip to content

docs: define exact Sirius numeric contract - #29210

Merged
mergify[bot] merged 1 commit into
matrixorigin:mainfrom
aunjgr:feature/28968-exact-numeric-contract
Sep 21, 2026
Merged

mergify[bot] merged 1 commit into
matrixorigin:mainfrom
aunjgr:feature/28968-exact-numeric-contract

Conversation

@aunjgr

@aunjgr aunjgr commented Sep 21, 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:

Refs #28968 and #28966. This design/inventory PR does not close either issue.

What this PR does / why we need it:

Defines the exact-numeric semantic contract required before embedded Sirius can execute every canonical TPC-H query without decimal narrowing, floating conversion, skipped assertions, or local fallback.

  • Specifies a versioned exact-decimal UDT/function family covering MatrixOne Decimal64, Decimal128, and Decimal256 physical domains.
  • Pins precision, scale, nullability, rounding, overflow, division-by-zero, aggregate-state, and result-metadata behavior.
  • Includes independent counterexamples/oracles and resource/performance requirements.
  • Establishes a hard reviewed-revision gate before any production lowering is allowed.
  • Adds an executable Q1-Q22 current-main inventory with exact first failure, reason, physical numeric signatures, and positive output-metadata controls.

Current inventory: Q2, Q4, Q12, Q13, Q16, Q18, Q21, and Q22 are eligible; the other 14 queries decline explicitly. That is a blocker inventory, not a fallback or rollout claim. This PR changes no production eligibility or execution path.

Validation on the exact branch:

  • All 22 named inventory subtests passed.
  • Full pkg/sql/plan/substrait package passed through the repository CGo-aware wrapper.
  • Default go test vet checks, gofmt, whitespace, and manual Markdown checks passed.
  • No BVT/race needed for this deterministic design/inventory-only change.
  • No containers and no mo-pr-guard run.

Reviewers should approve the exact design revision only if the wire representation and every semantic/error/metadata rule are acceptable; later native and MO implementation PRs must cite that approved revision.

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

@matrix-meow matrix-meow added the size/M Denotes a PR that changes [100,499] lines label Sep 21, 2026
@mergify mergify Bot added kind/documentation Improvements or additions to documentation kind/test-ci kind/api-change labels Sep 21, 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.

Reviewed exact head 98f37b2 against main 510e28e.\n\nThe N0 design/inventory gate passes. The exact-decimal representation, physical-width/precision/scale/nullability identity, rounding/overflow/division/NULL/aggregate/metadata contracts, capability rejection flow, bounded-resource requirements, alternatives, and staged approval gates are coherent. The Q1-Q22 inventory is deterministic and correctly keeps unsupported queries declined without treating fallback as success.\n\nThis is a design/inventory-only change with no production enablement, so BVT is not required here. Future native/MO implementation PRs must link this exact approved revision and provide the specified independent public SQL parity, error/metadata, GPU, failure, and performance evidence before lowering or default cutover.

@mergify mergify Bot added the queued label Sep 21, 2026
@mergify

mergify Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-09-21 13:26 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-09-21 13:27 UTC · at 71d01aca0270201668c126e085200c6880d364b7 · squash

This pull request spent 23 seconds in the queue, including 2 seconds running CI.

Required conditions to merge

@mergify
mergify Bot merged commit 71d01ac into matrixorigin:main Sep 21, 2026
23 of 24 checks passed
@mergify mergify Bot removed the queued label Sep 21, 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.

Correction to the prior review after the complete exact-head design audit.\n\nREQUEST_CHANGES at exact head 98f37b2.\n\nThe design-first gate has concrete semantic blockers:\n\n1. docs/design/sirius-numeric.md:191–201 requires raw signed-256 intermediate overflow to fail, but the current native MO d256MulSlowOne/d256MulScaledFallback path uses a 512-bit scratch product and accepts raw overflow when the scaled result fits. The existing TestD256MulScaledRawOverflow fixes this behavior. For example, two DECIMAL(41,30) values of 10000000000 have a raw coefficient of 10^80 but a valid DECIMAL256(65,30) result coefficient of 10^50. The design must define overflow at the correct operation boundary and add this oracle.\n\n2. docs/design/sirius-numeric.md:186–196 requires declared-precision checks for scalar results, but current Decimal256 division follows decimalBatchArith without the precision check used by add/subtract/multiply. Resolve this conflict with the no-SQL-behavior-change invariant and pin the semantic baseline.\n\n3. Sections 3–5 do not define how statement kind/strict mode/IGNORE reach the native consumer or how native numeric failures map to distinct MatrixOne error classes. Type signatures alone cannot distinguish SELECT division-by-zero from qualifying strict DML. Freeze the carrier and error mapping, or explicitly reject unsupported contexts at preparation.\n\nThe Q1–Q22 inventory remains useful admission evidence; this correction is about design contradictions and cross-endpoint contract closure, not BVT or coverage percentage.

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/api-change kind/documentation Improvements or additions to documentation kind/test-ci size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants