Repository navigation
fix: support dynamic precision for ROUND and TRUNCATE - #28502
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.
Review 结论:APPROVE。
Exact head: 623daa4
旧 review 中的两个 blocker 已确认修复:
- 动态 ROUND precision 现在在 zonemap 中保守返回未知范围,避免错误裁剪块。
- 参数 frame 按需扩容,且新增测试覆盖同一 wrapper 的
const → NULL → flat → masked → const状态切换。
当前未发现 confirmed blocker。非阻塞建议:补充 Decimal 极端 precision/整数边界、错误后复用、真实 Hive 分区表示切换及性能长尾验证。
未执行本地 Go UT/race、现场 SQL/Hive 反例、故障注入、性能及版本兼容矩阵。
Merge Queue Status
This pull request spent 42 minutes 20 seconds in the queue, with no time running CI. ReasonThe pull request can't be updated
HintYou should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. Tick the box to put this pull request back in the merge queue (same as
|
…8502) ## What type of PR is this? - [x] BUG ## Which issue(s) this PR fixes: issue matrixorigin#28492 ## What this PR does / why we need it: ROUND and TRUNCATE now evaluate a non-constant precision expression for each row and propagate NULL precision values as NULL, matching MySQL compatibility behavior. Constant precision keeps the existing fast path, while CEIL and FLOOR retain their constant-precision contract. The change adds focused vector-function coverage for positive, zero, negative, and NULL precision values, and enables the existing SQL regression coverage for dynamic DECIMAL precision. ## Validation - `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -run 'TestRoundAndTruncateWithDynamicDigits|TestTruncate$' ./pkg/sql/plan/function` - `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 ./pkg/sql/plan/function` --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…8502) ## What type of PR is this? - [x] BUG ## Which issue(s) this PR fixes: issue matrixorigin#28492 ## What this PR does / why we need it: ROUND and TRUNCATE now evaluate a non-constant precision expression for each row and propagate NULL precision values as NULL, matching MySQL compatibility behavior. Constant precision keeps the existing fast path, while CEIL and FLOOR retain their constant-precision contract. The change adds focused vector-function coverage for positive, zero, negative, and NULL precision values, and enables the existing SQL regression coverage for dynamic DECIMAL precision. ## Validation - `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -run 'TestRoundAndTruncateWithDynamicDigits|TestTruncate$' ./pkg/sql/plan/function` - `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 ./pkg/sql/plan/function` --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…8502) ## What type of PR is this? - [x] BUG ## Which issue(s) this PR fixes: issue matrixorigin#28492 ## What this PR does / why we need it: ROUND and TRUNCATE now evaluate a non-constant precision expression for each row and propagate NULL precision values as NULL, matching MySQL compatibility behavior. Constant precision keeps the existing fast path, while CEIL and FLOOR retain their constant-precision contract. The change adds focused vector-function coverage for positive, zero, negative, and NULL precision values, and enables the existing SQL regression coverage for dynamic DECIMAL precision. ## Validation - `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -run 'TestRoundAndTruncateWithDynamicDigits|TestTruncate$' ./pkg/sql/plan/function` - `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 ./pkg/sql/plan/function` --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…9765) 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. Approved by: @XuPeng-SH
What type of PR is this?
Which issue(s) this PR fixes:
issue #28492
What this PR does / why we need it:
ROUND and TRUNCATE now evaluate a non-constant precision expression for each row and propagate NULL precision values as NULL, matching MySQL compatibility behavior. Constant precision keeps the existing fast path, while CEIL and FLOOR retain their constant-precision contract.
The change adds focused vector-function coverage for positive, zero, negative, and NULL precision values, and enables the existing SQL regression coverage for dynamic DECIMAL precision.
Validation
.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -run 'TestRoundAndTruncateWithDynamicDigits|TestTruncate$' ./pkg/sql/plan/function.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 ./pkg/sql/plan/function