apache / apache/arrow

[C++] Support DST-aware timestamp + interval addition

Open
#47,400 6 comments 0 reactions 0 assignees View on GitHub
Component: C++ Status: stale-warning Type: enhancement
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

### Describe the enhancement requested

In Pandas, there is a way to do "day offset shift" that is day light saving aware, e.g.

```
import pyarrow as pa
import pandas as pd
import pyarrow.compute as pc

begin = pd.Timestamp('20250308 9:30', tz='America/New_York')
print(begin)
print(begin + pd.DateOffset(days=1))
print(begin + pd.DateOffset(days=2))
```

Outputs:
```
2025-03-08 09:30:00-05:00
2025-03-09 09:30:00-04:00
2025-03-10 09:30:00-04:00
```

However, there is no way to do such operations as far as I am aware with arrow compute, the closest I found is this
```
begin = pa.scalar(pd.Timestamp('20250309', tz='America/New_York'))
pc.add(begin, pa.scalar((0, 1, 0), type=pa.month_day_nano_interval()))
```

However, it seems not supported, I also didn't find any specific arrow compute function to do this.

IMO this would be really useful to deal with time in non-UTC timezone.

### Component(s)

C++

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.