Describe the bug
to_timestamp can panic during planning/constant folding for large Decimal128 values. The decimal-to-nanoseconds conversion multiplies by a power of ten without checking for overflow.
To Reproduce
EXPLAIN SELECT to_timestamp(
arrow_cast('99999999999999999999999999999999999999', 'Decimal128(38,0)')
);
Actual behavior
thread 'main' panicked at datafusion/functions/src/datetime/to_timestamp.rs:338:9:
attempt to multiply with overflow
Expected behavior
Return an overflow error instead of panicking.
Notes
The panic is in decimal_to_nanoseconds.
Describe the bug
to_timestampcan panic during planning/constant folding for largeDecimal128values. The decimal-to-nanoseconds conversion multiplies by a power of ten without checking for overflow.To Reproduce
Actual behavior
Expected behavior
Return an overflow error instead of panicking.
Notes
The panic is in
decimal_to_nanoseconds.