-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Description
Part of #3869
Description
PR #10083 added checked_add, checked_subtract, checked_multiply, and
checked_divide for integer and floating-point types to support Spark's ANSI mode.
However, other arithmetic "checked" operators with decimal type were not included.
In Spark's ANSI mode (spark.sql.ansi.enabled=true), decimal arithmetic overflow
should raise an error rather than returning null. Decimal multiplication
goes through CheckOverflow(BinaryArithmetic, decimalType, nullOnOverflow=false),
which requires a checked variant that throws on overflow.
Currently, the existing multiply for decimal types returns null on overflow
(matching Spark's default non-ANSI behavior). We need decimal checked_multiply
that returns an error status on overflow instead. This follows the same pattern
established by checked_divide (PR #14935) and checked_add/checked_subtract
(PR #16302).
Scope
checked_multiplyfor all decimal input combinations (short/long x short/long)- Both
allowPrecisionLossanddenyPrecisionLossvariants