Repository navigation
test: cover TRUNCATE with DECIMAL input and runtime INT precision - #29765
mergify[bot] merged 1 commit into
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
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.
Merge Queue Status
This pull request spent 15 seconds in the queue, including 1 second running CI. Required conditions to merge
|
What type of PR is this?
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
TRUNCATEprecision withDECIMAL(10,4)input and anINTprecision column, including bothdandd + 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
ROUNDandTRUNCATEfrom #28502; this PR adds the missing DECIMAL/INT regression coverage and makes no production-code changes.Validation:
make -j8 buildon current main (with verified ONNX_PREBUILT_DIR set) (dca6ffc2b, Go 1.27.1 darwin/arm64): passed.func_math_dynamic_precision.teston 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 on23d8f6125; reused after the base update because the intervening source changes are outside this package's test dependency closure.