Skip to content

[C++] Overflow in subtract_checked(timestamp, timestamp) after casting to pandas and back. #43031

Open
@randolf-scholz

Description

@randolf-scholz

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

Cross post from pandas-dev/pandas#59082

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions