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
[C++][Python] round_temporal/floor_temporal/ceil_temporal crash the process with multiple=0 #55921
Describe the bug, including details regarding any error messages, version, and platform.
round_temporal, floor_temporal and ceil_temporal don't validate multiple. With multiple=0 the whole Python process crashes with an integer division by zero instead of raising an error.
importpyarrowaspaimportpyarrow.computeaspcarr=pa.array([1000], type=pa.timestamp("ns"))
pc.floor_temporal(arr, multiple=0, unit="second") # process exits, no Python exception
Same for round_temporal and ceil_temporal. On Windows the exit code is 0xC0000094 (STATUS_INTEGER_DIVIDE_BY_ZERO).
A negative multiple doesn't crash but gives wrong results, e.g. ceil_temporal returns a time before the input:
For comparison, round_to_multiple already checks this:
pc.round_to_multiple(pa.array([5.0]), multiple=0)
# ArrowInvalid: Rounding multiple must be positive
Expected: ArrowInvalid for multiple <= 0 in all three temporal functions. I checked cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc on main and didn't find a check on options.multiple, so an early Status::Invalid("Rounding multiple must be positive") in the kernel (or in RoundTemporalOptions validation) would match round_to_multiple.
pyarrow 26.0.1 (latest on PyPI), Python 3.12, Windows 11.
Activity