[C++] Overflow in `subtract_checked(timestamp, timestamp)` after casting to pandas and back.
Open
Component: C++
Component: Python
Type: bug
- Dominant language
- C++
- Stars
- 17.1k
- Forks
- 4.3k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 88
Description
### Describe the bug, including details regarding any error messages, version, and platform.
Cross post from https://github.com/pandas-dev/pandas/issues/59082
```python
from datetime import datetime, timedelta
import pyarrow as pa
timestamps = [None, datetime(2022, 1, 1, 10, 0, 30), datetime(2022, 1, 1, 10, 1, 0)]
x = pa.array(timestamps, type=pa.timestamp("ms"))
pa.compute.subtract_checked(x, x) # ✅
# convert to pandas and back
y = pa.Array.from_pandas(x.to_pandas())
assert x == y # ✅
pa.compute.subtract_checked(y, x) # ✅
pa.compute.subtract_checked(x, y) # ❌ overflow
```
- python 3.11
- pyarrow 16.1.0
- pandas 2.2.2
- numpy 2.0.0
### Component(s)
Python
Contributor guide
Assessment
This issue has not been assessed yet.