Skip to content

fix(plan): derive MOD decimal precision from original operands - #30170

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
iamlinjunhong:fix/mod-decimal-metadata-30157
Oct 14, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
iamlinjunhong:fix/mod-decimal-metadata-30157

Conversation

@iamlinjunhong

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:

Derives DECIMAL MOD / % precision and scale from the original exact operands, matching MySQL. DECIMAL(10,3) MOD INT now exposes DECIMAL(10,3); DECIMAL(18,3) MOD BIGINT exposes precision 19, or 20 for unsigned BIGINT. The corrected metadata reaches CTAS, views, CASE and COALESCE.

Function resolution and numeric inference retain original operand domains. The binder refines literal precision only for result metadata. Execution storage types, implicit cast targets and remainder kernels stay unchanged. Coverage includes integer widths and signedness, MEDIUMINT, both operand orders, literals and explicit casts, decimal controls and existing temporal/string/NULL behavior. This changes newly derived metadata; it does not migrate existing table schemas.

Validation

  • Focused MOD resolver, inference and binder regressions pass; the initial regressions failed on the unfixed base for the reported precision mismatch.
  • Full pkg/sql/plan/function and pkg/sql/plan suites pass.
  • Real single-CN SQL integration passes CTAS/view schema, direct/materialized/prepared protocol metadata, CASE/COALESCE, positive/negative/NULL values and zero divisor checks.
  • Incremental go vet, repository-configured golangci-lint and git diff --check pass.
  • Local validation uses Go 1.27.1 on macOS arm64 with repository-built native libraries. CI is pending.

The change adds bounded metadata work at binding time and no per-row execution work. Please have the reporter verify #30157 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 →

@XuPeng-SH

XuPeng-SH commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 459b486985ffe5e1d30066d46340104635b95d5d

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: 459b486985ffe5e1d30066d46340104635b95d5d

Assessment: approve

Reviewed the complete seven-file delta and affected consumers. The shared metadata helper restores original-operand precision while preserving execution casts and kernels. Design, cleanup, compatibility and test coverage are sound; added work is bounded to binding. No actionable findings remain.

Model: gpt-6-astra / xhigh

Session: 01a12d8f-8e48-7622-ad17-b605f08450ce · slot 1 · generation 0

Validation:

  • All six new regression tests passed with -count=1 through the supplied isolated executor across function, plan and sqlintegration packages. SQL coverage includes CTAS/view schemas, direct/materialized/prepared metadata, CASE/COALESCE, signed values, NULL and zero divisors.

  • Original-production overlay control failed for the intended precision mismatches; identical assertions passed on the candidate.

  • Isolation preflight passed. Repository-owned native build succeeded; 192 native/module inputs were matched to the frozen checkout. Source remained unchanged and git diff --check passed.

  • Commands, source fingerprints, terminal exits and retained logs were reconciled in /home/xupeng/.local/state/mo-bot/jobs/8ac62e18559d245a600f443d/attempt-1/evidence-audit.json. Candidate receipt: checks/1792011129936154606-4.json; baseline-control receipt: checks/1792011180721961750-4.json.

  • Reused the supplied exact-head successful Ubuntu UT, arm64 SCA, coverage and proxy/multi-CN BVT statuses for broader coverage.

Limitations:

  • Broader CI raw logs were not supplied; full suites were not repeated locally.

  • Issue #30157's standalone body was absent; its contract was assessed from the frozen PR description and regression examples.

  • No performance benchmark was run; no per-row execution change or material regression risk was identified.

@mergify mergify Bot added the queued label Oct 14, 2026
@mergify

mergify Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-14 20:54 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🚫 Left the queue — 2026-10-14 21:54 UTC · at 459b486985ffe5e1d30066d46340104635b95d5d

This pull request spent 59 minutes 15 seconds in the queue, with no time running CI.

Reason

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

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

  • Requeue this pull request

This branch was previously deployed

1 inactive deployment
ci — 8a8fc78c Deployed Oct 14, 2026 by mergify[bot]
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/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants