Skip to content

fix: widen integer addition and multiplication - #31088

Merged
mergify[bot] merged 10 commits into
matrixorigin:mainfrom
iamlinjunhong:codex/loom/develop/db2833f5315552e754c4c50913d42d93cf8e7fa48004922f0dcfa9bd896c1f66
Oct 28, 2026
Merged

mergify[bot] merged 10 commits into
matrixorigin:mainfrom
iamlinjunhong:codex/loom/develop/db2833f5315552e754c4c50913d42d93cf8e7fa48004922f0dcfa9bd896c1f66

Conversation

@iamlinjunhong

@iamlinjunhong iamlinjunhong commented Oct 25, 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:

What this PR does / why we need it:

Integer column addition and multiplication currently retain narrow operand widths. For example, squaring a TINYINT value of 100 raises error 1690 instead of returning 10000. Resolve true integer + and * in signed or unsigned 64-bit execution domains, preserving checked overflow at the 64-bit boundary. Mixed signed/unsigned inputs retain their signs and use the existing checked mixed-integer overload.

Track logical precision independently from physical execution width using optional, validated query metadata. This keeps wire type/flags/length, CTAS inference and view descriptors consistent with the original SQL expression. Preserve precision through casts, folding, query boundaries and prepared rebinding; retain effective parameter domains across NULL execution and keep metadata caches aligned. Internal grouping/window rewrites preserve expression identity, while real SQL references retain their own schema classification.

Design submission: Integer arithmetic execution width and logical precision — revision 1. The RFC describes implementation f182916ca22c62b56046373303b8cf1fdcd1bab9 and addresses the missing design artifact in review 5643764396. Status is draft; independent repository design approval remains pending. This submission documents existing behavior and does not assert implementation acceptance.

Validation for CI refresh (candidate aa076bc6641235e983f803a844aff40dd9282022, official base 935811ca9859f420f1836963c9730cf6345f9d2a):

  • Rebased the existing seven patches without semantic changes (git range-diff: all equal). Preserved the upstream streaming SORT ROLLUP paths and this PR's precision/provenance metadata.
  • Previous CI run 40554828749 passed shared build, Ubuntu UT/coverage and PROXY BVT. Arm64 SCA lost its self-hosted runner before completing; its log is unavailable and the direct GitHub annotation records communication loss. The COMPOSE/PESSIMISTIC BVT separately failed clone_in_alter_table.sql:87 with txn write conflict ... source admission changed while a background HNSW update overlapped ALTER index locking. Coverage merge reports missing prerequisites and no coverage verdict; Required aggregates the failed jobs.
  • BVT attribution remains unresolved: a verified effective-main source overlay at 935811ca executed the original 1002-row indexed t2 setup and ALTER three times successfully on Darwin/arm64 with two CNs and Pessimistic/RC. This is not a Linux CI reproduction, does not exonerate this PR, and does not establish a flaky classification. No unrelated ALTER code or test expectation was changed. This refresh addresses runner failure by triggering new CI; it does not claim the ALTER failure is fixed. The old run is not rerun.
  • New merged-code validation: 115 focused test roots passed across frontend/planner/compiler/group. Two public SQL roots passed: the existing integer width/CTAS/window suite under forced SORT and HASH, paired EXPLAIN checks proving the distinct execution paths, and unsigned prepared parameter metadata retained through algorithm-triggered rebuild followed by NULL execution. Four-package go vet -mod=readonly passed; configured golangci-lint run -c .golangci.yml passed for the same four packages with 0 issues. Changed Go files pass gofmt; committed artifact checks pass. Temporary comparison harnesses and raw records remain outside source.
  • Reused unchanged protobuf/postprocessor, parser and unrelated arithmetic/native evidence. RFC revision 1 is unchanged and remains draft, pending independent design approval. Cross-binary mixed-version metadata equivalence and a dedicated graph-capacity budget remain unverified, as stated in the RFC.

Scope and compatibility: nullable integer columns are covered. Existing table schemas and historical view catalog descriptors are not migrated by SELECT; recreating a view refreshes its descriptor. Older executors must already support the existing mixed-integer overload 2. The issue is left open for the reporter to validate after merge.

@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/XL Denotes a PR that changes [1000, 1999] lines label Oct 25, 2026
@mergify mergify Bot added the kind/bug Something isn't working label Oct 25, 2026
@XuPeng-SH

XuPeng-SH commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: aa076bc6641235e983f803a844aff40dd9282022

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: aa076bc6641235e983f803a844aff40dd9282022

Assessment: approve

Reviewed the complete 53-file delta, linked issue and full discussion. No actionable defects remain. The RFC resolves the missing-design concern; independent review accepts its ownership and lifecycle design. The earlier draft-status-only blocker is unsupported by the current review contract.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1586-7a01-9000-d45e20995cf8 · slot 1 · generation 1

Validation:

  • Isolated preflight passed. Both protobuf postprocessor packages and the full pkg/pb/plan suite passed. The initial missing-jemalloc compilation failure was resolved using the frozen repository’s build owner.

  • Generated-code and final static audits passed; verified frozen source identity, unchanged checkout, matching patch and all seven discussion dispositions.

  • Reconciled commands, source fingerprints, exits and retained logs in /home/xupeng/.local/state/mo-bot/jobs/c809a0399760f4ec0c002977/attempt-1/validation-record.json. Discussion reconciliation is saved alongside it in discussion-assessment.json.

  • Reused frozen exact-head successful build, UT/coverage, SCA, multi-CN BVT and Connector/J reset CI statuses.

Limitations:

  • Raw CI and author-reported execution artifacts were not supplied. Full frontend/planner/SQL suites and benchmarks were not rerun locally.

  • No cross-binary rollout or dedicated graph-capacity guarantee is established; these documented limits do not violate the reviewed scope.

@mergify

mergify Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

🚫 Left the queue

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

So far

  • ✅ Entered the queue Tue 27 Oct, 20:42 · rule main · triggered by rule Automatic queue on approval for main
  • 🚫 Left the queue 21:50 · aa076bc

Reason

Pull request #31088 has been dequeued

Queue conditions are not satisfied:

  • -conflict [📌 queue requirement]

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.

Requeued — the merge queue status continues in this comment ↓.

Times in UTC · dashboard · how the merge queue works

Resolve true integer + and * in their signed or unsigned 64-bit execution domains. Preserve logical precision independently for result metadata, CTAS, views and prepared rebinding.

Related issue:
Publish only visible set-operation headings while preserving root binding semantics. Keep grouping rewrites transparent to logical integer precision and retain SQL reference classification when identical UNION branches collapse.

Cover top-level and prepared set operations, grouping CTAS roots and schema readback.
Track the exact derived SELECT generated for grouping and window evaluation. Keep that internal boundary transparent to integer precision while retaining real SQL reference boundaries.

Cover window output and ORDER BY, CTAS schema/readback, and genuine derived, CTE and view reference controls.
Normalize integer VALUES text and JSON conversions from their numeric domain while retaining lexical digits for precision metadata. Cover signed, unsigned and character controls and align existing arithmetic goldens with 64-bit evaluation and target assignment errors.

Use moerr for integer precision admission so the repository error-policy check passes. Validated protobuf/util packages, planner precision tests, incremental static checks and 1447 SQL statements twice through mo-tester.
Read widened dependent projections as int64, preserve native filter transpose coverage beside a widened-cast control, and expect the physical casts in EXPLAIN. Make the affine SUM prepared fixture explicitly signed so its negative rebind continues to validate the original six sums.

Validated the three exact failing UTs with coverage, all owning packages, planner arithmetic controls, incremental static checks, and both affine and mixed-unsigned SQL cases twice through mo-tester.
@XuPeng-SH

XuPeng-SH commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: c8612710b0218587206909c87481e4cbbf9fa65a

Review belongs to an older commit; it is not a review of the current head.

@mergify

mergify Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

✅ Merged into main as 66c9e76 at Wed 28 Oct, 02:53 UTC

3 h 49 min in the queue, 1 h 9 min of it CI.

So far

  • ✅ Entered the queue Tue 27 Oct, 23:05 · rule main · triggered by rule Automatic queue on approval for main
  • ✅ Passed · in place
  • ✅ Merged Wed 28 Oct, 02:53 · 66c9e76 · squash
Merge conditions: 3 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-success = CI Required, check-neutral = CI Required, check-skipped = CI Required GitHub branch protection

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

kind/bug Something isn't working size/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants