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 ... SQL syntax produces inconsistent types #5801

Closed
Tracked by #5753
alamb opened this issue Mar 30, 2023 · 3 comments · Fixed by #5806
Closed
Tracked by #5753

INTERVAL ... SQL syntax produces inconsistent types #5801

alamb opened this issue Mar 30, 2023 · 3 comments · Fixed by #5806
Labels
bug Something isn't working datafusion Changes in the datafusion crate

Comments

@alamb
Copy link
Contributor

alamb commented Mar 30, 2023

The same SQL syntax

interval '5 months'
interval '5 days 3 nanoseconds'

Produces two different data types.

select   arrow_typeof(interval '5 months'),
  arrow_typeof(interval '5 days 3 nanoseconds')
;
+-------------------------------------+-----------------------------------------------------------+
| arrowtypeof(IntervalYearMonth("5")) | arrowtypeof(IntervalMonthDayNano("92233720368547758083")) |
+-------------------------------------+-----------------------------------------------------------+
| Interval(YearMonth)                 | Interval(MonthDayNano)                                    |
+-------------------------------------+-----------------------------------------------------------+

I would like it it to produce the same datatype always (in this case IntervalMonthDayNano) so that it has the same type as the SQL INTERVAL typed, added in #5792

this is inconsistent with '5 days 3 nanoseconds'::interval, an explicit cast to interval.

@alamb alamb added bug Something isn't working datafusion Changes in the datafusion crate labels Mar 30, 2023
@alamb
Copy link
Contributor Author

alamb commented Mar 30, 2023

The reason two different data types are produced I think is hisorical -- DataFusion's support for interval predates broader arrow-rs support for interval (e.g. apache/arrow-rs#3958).

@alamb
Copy link
Contributor Author

alamb commented Mar 31, 2023

I am actively working on this item

@alamb
Copy link
Contributor Author

alamb commented Mar 31, 2023

#5806

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working datafusion Changes in the datafusion crate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant