Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interval plus(+) Timestamp operation support #5413

Closed
Tracked by #3148
berkaysynnada opened this issue Feb 27, 2023 · 2 comments · Fixed by #5491
Closed
Tracked by #3148

Interval plus(+) Timestamp operation support #5413

berkaysynnada opened this issue Feb 27, 2023 · 2 comments · Fixed by #5491
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@berkaysynnada
Copy link
Contributor

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
While we can add intervals to timestamp variants (LHS: Timestamp (like TimestampSecond), RHS: Interval (like IntervalYearMonth)), we cannot replace the sides (LHS: Interval, RHS: Timestamp), and get the error
Err(Internal("Operator + is not implemented for variants IntervalYearMonth(\"1\") and TimestampSecond(12345678, None)"))
Addition should be commutative for intervals and timestamps, unlike subtraction.

Describe the solution you'd like
In impl_op macro, the match arms can be extended to handle Interval variants for addition, and an adder function can be implemented.

Describe alternatives you've considered
Only the order of the parameters can be changed before calling that impl_op macro since Timestamp + Interval operations are working.

Additional context
This feature can also be extended to cover operations between interval variants (IntervalYearMonth, IntervalDayTime, IntervalMonthDayNano). We can use addition and subtraction operators between them (negatively resulting situations should be under consideration).

@berkaysynnada berkaysynnada added the enhancement New feature or request label Feb 27, 2023
@alamb alamb added the good first issue Good for newcomers label Mar 6, 2023
@alamb
Copy link
Contributor

alamb commented Mar 6, 2023

I think this would be a good first issue as datafusion already supports timestamp + interval so this PR is about figuring out enough of binary.rs to support interval + timestamp. Also added to #3148 to track

@alamb
Copy link
Contributor

alamb commented Mar 7, 2023

And there is a proposed PR to add this functionality: #5491 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants