You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Decimal scalars panic on a stored value outside the precision #10749
Two decimal operations panic when a stored value does not fit the precision of the dtype. DecimalArray::scalar_at (vortex-array/src/arrays/decimal/vtable/operations.rs:23) and the decimal min_max aggregate (vortex-array/src/aggregate_fn/fns/min_max/decimal.rs) build their results with Scalar::decimal, which calls vortex_expect on the precision check of Scalar::try_new (vortex-array/src/scalar/constructor.rs). DecimalArray construction does not check its values, and file reads trust the stored precision, so a file that holds such a value can make a read panic instead of returning an error.
Steps to reproduce
let array = DecimalArray::new(buffer![100i8],DecimalDType::new(2,0),Validity::NonNullable).into_array();// Both calls panic.
array.execute_scalar(0,&mut ctx);min_max(&array,&mut ctx,Default::default());
panicked at vortex-error/src/lib.rs:716:9:
unable to construct a decimal `Scalar`:
Other error: decimal value decimal8(100) does not fit in precision of decimal(2,0)
Expected: an error from both calls, or a contract that rules out the value before it reaches them.
Environment
develop at 3974ee069c, run as a unit test in vortex-array.
Additional context
Scalar::decimal has other callers on read and compute paths, for example sum, mean, cast, fill_null, between, and the DecimalByteParts compare and between kernels. They have not been checked one by one. #10701 makes DecimalArray::try_new check every valid value, but file reads keep trusting the stored precision, so this stays reachable without a separate fix.
Activity