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
[Python][C++][Compute] Integer round crashes for uint64 with ndigits=-19 and gives wrong half-rounding for large multiples #55908
Describe the bug, including details regarding any error messages, version, and platform.
round / round_binary on uint64 with ndigits=-19 crash the process, and round_to_multiple
on integers returns wrong results in the HALF_* modes when the multiple is larger than half the
type's maximum.
Causes, in cpp/src/arrow/compute/kernels/scalar_round.cc:
the ndigits range check allows up to digits10 (19 for uint64), but the integer RoundUtil::Pow10
table stops at 10^18, so lut[19] is read past the end (0 in release builds -> division by zero).
RoundToMultiple<integer> compares remainder * 2 with multiple, which overflows when multiple > max / 2.
I ran into this while testing integer rounding at the edges of each type's range, and the uint64 case taking down the whole Python process rather than raising an error is what made me dig in.
Reproduced on main (52d252f) and pyarrow 27.0.0.dev204 nightly, Linux x86_64, Python 3.13.
I have a small fix with tests (add 10^19 to the table; compare remainder against multiple - remainder) and can open a PR.
This issue was drafted with help from an AI assistant and checked by me.
changed the title [-][C++][Compute] Integer round crashes for uint64 with ndigits=-19 and gives wrong half-rounding for large multiples[/-][+][Python][C++][Compute] Integer round crashes for uint64 with ndigits=-19 and gives wrong half-rounding for large multiples[/+]on Dec 2, 2026
Activity
[-][C++][Compute] Integer round crashes for uint64 with ndigits=-19 and gives wrong half-rounding for large multiples[/-][+][Python][C++][Compute] Integer round crashes for uint64 with ndigits=-19 and gives wrong half-rounding for large multiples[/+]