Skip to content

[C++] mean overflows if numeric sum is larger than int64 max #34909

@rohanjain101

Description

@rohanjain101

Describe the bug, including details regarding any error messages, version, and platform.

>>> arr = pa.array([-1303487490025821099, -8371390547526583103, -2572374159461887095], type=pa.int64())
>>> pa.compute.mean(arr)
<pyarrow.DoubleScalar: 2.0664972922317535e+18>
>>>

When using numpy:

>>> arr.to_numpy().mean()
-4.0824173990047636e+18
>>>

Seems like overflow case is not handled correctly when using arrow array.

Component(s)

Python

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions