Skip to content

test: cover TRUNCATE with DECIMAL input and runtime INT precision - #29765

Merged
mergify[bot] merged 1 commit into
matrixorigin:mainfrom
Lundomn:codex/issue-29722-truncate-regression
Oct 9, 2026
Merged

mergify[bot] merged 1 commit into
matrixorigin:mainfrom
Lundomn:codex/issue-29722-truncate-regression

Conversation

@Lundomn

@Lundomn Lundomn commented Oct 9, 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:

References #29722. This test-only PR does not close the issue or claim to resolve the reported v4.2.5 release behavior.

What this PR does / why we need it:

Adds current-main BVT coverage for row-dependent TRUNCATE precision with DECIMAL(10,4) input and an INT precision column, including both d and d + 0. The rows cover positive precision, a non-tie value that distinguishes truncation from rounding, negative precision, and NULL. An integer mismatch count asserts exact decimal values and NULL behavior because the BVT harness tolerates small decimal differences.

Main already supports runtime precision for ROUND and TRUNCATE from #28502; this PR adds the missing DECIMAL/INT regression coverage and makes no production-code changes.

Validation:

  • make -j8 build on current main (with verified ONNX_PREBUILT_DIR set) (dca6ffc2b, Go 1.27.1 darwin/arm64): passed.
  • BVT func_math_dynamic_precision.test on current main: 34/34 statements passed, 0 failed.
  • .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=180s ./pkg/sql/plan/function: passed on 23d8f6125; reused after the base update because the intervening source changes are outside this package's test dependency closure.

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

@mergify mergify Bot added the kind/test-ci label Oct 9, 2026
@matrix-meow matrix-meow added the size/S Denotes a PR that changes [10,99] lines label Oct 9, 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.

APPROVE at 954fa8a0b4241a983c2a7f8117ecbe9f95f1bd8b against base/merge-base dca6ffc2bf21036627b221b67f05943fbe458cf0. No blocking findings after reviewing both complete changed files, issue #29722, the existing dynamic-precision case, overload conversion and the runtime precision owner. No subagents were used.

This is appropriately scoped regression coverage for current main. The report concerns release 4.2.5; the PR correctly references the issue without claiming to fix that release or close it. Main's existing generalMathMulti selects the row-dependent binary kernel for ROUND/TRUNCATE, while TRUNCATE's integer-argument conversion admits an INT column into the existing int64 precision overload. The new DECIMAL(10,4)/INT fixture covers a distinct public conversion/input combination beyond the existing BIGINT-precision decimal64/128/256 rows.

The four rows have distinct purposes: the original reproducer, 1.2395 which distinguishes truncation from rounding, negative precision, and NULL precision. d and d + 0 cover direct and expression precision inputs. I independently checked the expected arithmetic against the MySQL TRUNCATE contract. The extra mismatch assertion is useful: wrong non-NULL values and unexpected NULLs fall into ELSE 1; it compares against fixed exact decimal expectations rather than another implementation of TRUNCATE. Even though SUM is represented as DECIMAL(38,0), zero versus a positive integer remains a strict failure in the CI mo-tester revision 309a0ca650e0c55e90292767fd61e4976818d66d (RSCell explicitly rejects zero/nonzero before tolerance). Thus simply returning the untruncated input cannot hide behind golden-result decimal rounding.

The test extends the existing fixture with one four-row table and five SQL statements; it adds no sessions, servers, sleeps, retry loops or new test framework. Existing deterministic ordering, optimizer-hint restoration and final DROP DATABASE cover the new table. Existing negative-input, other decimal-width, filter and prepared-reuse scenarios remain intact. There are no obsolete production branches or duplicate runtime state to remove. No human review comments/threads existed before this review; the only comment was the automated paused-review notice.

Validation reused exact-head CI run 37887660343, Go1.27.1/linux-amd64 with the shared binary identified as this head. The Proxy BVT job names and executes func_math_dynamic_precision.test: 34/34 successful, zero failed/ignored/abnormal, 0.727s for the entire case. The other BVT shard is not counted as execution of this file. git diff --check passed. No redundant local cluster or unrelated Go test run was needed; no independent same-instance replay is claimed.

Accounting: production +0/-0, SQL tests +15/-0, expected results +22/-0, documentation +0/-0. There is no production or TP runtime performance impact from this PR. The measured case duration is not an incremental before/after benchmark.

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

mergify Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-09 06:23 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-10-09 06:23 UTC · at b6fa8ccfc729105a31f61dbed0c97d7f21a2b86e · squash

This pull request spent 15 seconds in the queue, including 1 second running CI.

Required conditions to merge

This branch was previously deployed

1 inactive deployment
ci — 954fa8a0 Deployed Oct 9, 2026 by mergify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/test-ci size/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants