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

Timestamp and Interval arithmetics #5704

Closed
Tracked by #3148 ...
berkaysynnada opened this issue Mar 23, 2023 · 2 comments · Fixed by #5764, #5846 or #6069
Closed
Tracked by #3148 ...

Timestamp and Interval arithmetics #5704

berkaysynnada opened this issue Mar 23, 2023 · 2 comments · Fixed by #5764, #5846 or #6069
Labels
enhancement New feature or request

Comments

@berkaysynnada
Copy link
Contributor

Is your feature request related to a problem or challenge?

When we write such queries:
1)SELECT val, ts1 - ts2 AS ts_diff FROM table_a ORDER BY ts2 - ts1,
2)SELECT val, interval1 - interval2 AS interval_diff FROM table_a ORDER BY interval2 - interval1 ,
3)SELECT val, ts1 - interval1 AS ts_interval_diff FROM table_a ORDER BY ts1 - interval1 DESC
we get errors like:
1)Plan("'Timestamp(Second, None) - Timestamp(Second, None)' is an unsupported operation. addition/subtraction on dates/timestamps only supported with interval types"),
2)Plan("'Interval(DayTime) - Interval(DayTime)' can't be evaluated because there isn't a common type to coerce the types to"),
3)Execution("Columnar execution is not yet supported for DateIntervalExpr")

These operations are applicable for scalar values; however, columnar operations are not supported yet.

Describe the solution you'd like

In planner.rs, binary.rs and datetime.rs, there are some match expressions that need to be extended to handle these cases. Considering the behavior in scalar value operations, required arithmetic operations can be implemented.

Describe alternatives you've considered

Additional context

@berkaysynnada berkaysynnada added the enhancement New feature or request label Mar 23, 2023
@doki23
Copy link
Contributor

doki23 commented Mar 23, 2023

somewhat duplicate #194

@alamb
Copy link
Contributor

alamb commented Mar 27, 2023

I added this ticket to a tracking epic #5753

I also plan to file upstream issues in arrow-rs to track supporting intervals in the array kernels

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
3 participants