[C++] Support temporal arithmetic ({time,date}{32,64}, timestamp, interval)
- Dominant language
- C++
- Stars
- 17.1k
- Forks
- 4.3k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 88
Description
[It appears that only subtract on two timestamps is currently supported](https://github.com/apache/arrow/commit/dd94a5809b56b32fe2fb538f688bf568d9642e3b) when there is more supported, we should include support for that in R.
This should also cover the ability to do with and without rollback (so have the ability to do e.g. 2021-03-30 minus 1 month and either get a null back, or 2021-02-28), plus the ability to specify whether to rollback to the first or last, and whether to preserve or rest the time.)
**Reporter**: [Jonathan Keane](https://issues.apache.org/jira/browse/ARROW-11090) / @jonkeane
**Watchers**: [Rok Mihevc](https://issues.apache.org/jira/browse/ARROW-11090) / @rok
#### Subtasks:
- [X] [[C++] add(date, duration) -> timestamp kernel](https://github.com/apache/arrow/issues/29684)
- [X] [[C++] subtract(date, duration) -> timestamp kernel](https://github.com/apache/arrow/issues/29685)
- [X] [[C++] subtract(date, date) -> duration kernel](https://github.com/apache/arrow/issues/29686)
- [X] [[C++] add(timestamp, duration) -> timestamp kernel](https://github.com/apache/arrow/issues/18856)
- [X] [[C++] subtract(timestamp, duration) -> timestamp kernel](https://github.com/apache/arrow/issues/29687)
- [X] [[C++] add(time, duration) -> time kernel](https://github.com/apache/arrow/issues/29688)
- [X] [[C++] subtract(time, duration) -> time kernel](https://github.com/apache/arrow/issues/29689)
- [X] [[C++] subtract(time, time) -> duration kernel](https://github.com/apache/arrow/issues/29690)
- [X] [[C++] add(duration, duration) -> duration kernel](https://github.com/apache/arrow/issues/29691)
- [X] [[C++] subtract(duration, duration) -> duration kernel](https://github.com/apache/arrow/issues/18857)
- [X] [[C++] multiply(duration, integer) -> duration kernel](https://github.com/apache/arrow/issues/29692)
- [X] [[C++] divide(duration, integer) -> duration kernel](https://github.com/apache/arrow/issues/29693)
- [ ] [[C++] interval_between(timestamptz, timestamptz) -> struct kernel](https://github.com/apache/arrow/issues/18858)
- [ ] [[C++] Support rolling backwards and forwards with temporal arithmetic](https://github.com/apache/arrow/issues/31334)
- [X] [[C++] Add_kernel not commutative (timestamps & duration maths)](https://github.com/apache/arrow/issues/31348)
- [ ] [[C++] temporal addition and subtraction with integers](https://github.com/apache/arrow/issues/32352)
#### Related issues:
- [[C++] C++ array kernels framework and execution buildout (umbrella issue)](https://github.com/apache/arrow/issues/25028) (is a child of)
- [[C++] Implement maths with timestamps](https://github.com/apache/arrow/issues/30469) (is duplicated by)
- [[C++] Add_kernel not commutative (timestamps & duration maths)](https://github.com/apache/arrow/issues/31348) (is related to)
- [[R] Implement lubridate's %m+%, %m-%, add_with_rollback, and addition and subtraction with timestamp](https://github.com/apache/arrow/issues/30470) (is depended upon by)
- [[R] Update as.Date() to support an origin different from epoch](https://github.com/apache/arrow/issues/31241) (is depended upon by)
- [[R] Implement lubridate functions for doing maths with dates](https://github.com/apache/arrow/issues/30467) (is depended upon by)
**Note**: *This issue was originally created as [ARROW-11090](https://issues.apache.org/jira/browse/ARROW-11090). Please see the [migration documentation](https://github.com/apache/arrow/issues/14542) for further details.*
Contributor guide
Research direction
Review the unchecked subtasks for interval_between, temporal rollback behavior, and temporal arithmetic with integers, along with their linked issue descriptions. Use the completed subtasks as scope context; the work is done when the remaining temporal arithmetic and rollback requirements are implemented and their corresponding issue items can be checked.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100