Skip to content

[VL] Support ANSI mode decimal Add/Subtract with checked overflow#11705

Draft
n0r0shi wants to merge 1 commit intoapache:mainfrom
n0r0shi:checked-decimal-add-subtract
Draft

[VL] Support ANSI mode decimal Add/Subtract with checked overflow#11705
n0r0shi wants to merge 1 commit intoapache:mainfrom
n0r0shi:checked-decimal-add-subtract

Conversation

@n0r0shi
Copy link

@n0r0shi n0r0shi commented Mar 5, 2026

Summary

  • Routes decimal Add and Subtract to Velox's checked_add and checked_subtract when ANSI mode is enabled (nullOnOverflow = false in CheckOverflow), so overflow throws instead of returning null.
  • Adds TRY mode support for decimal Add/Subtract using the try(checked_add/checked_subtract) pattern, consistent with how integer TRY arithmetic is already handled.
  • Previously, TRY mode for decimal arithmetic relied on a tryCast in CheckOverflowTransformer to detect overflow. This change uses the consistent try(checked_*) pattern instead.

Dependencies

Test plan

Routes decimal `Add` and `Subtract` to Velox's `checked_add` and
`checked_subtract` functions when ANSI mode is enabled
(`nullOnOverflow = false`). These checked variants throw on overflow
instead of returning null, matching Spark's ANSI behavior.

Depends on facebookincubator/velox#16302 which adds `checked_add` and
`checked_subtract` support for decimal types.
@github-actions github-actions bot added CORE works for Gluten Core VELOX labels Mar 5, 2026
@github-actions
Copy link

github-actions bot commented Mar 5, 2026

Run Gluten Clickhouse CI on x86

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CORE works for Gluten Core VELOX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant