alamb opened a new issue, #5651:
URL: https://github.com/apache/arrow-datafusion/issues/5651

   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   In DataFusion, we support SQL syntax like `INTERVAL '3 months'` that is then 
converted into Intervals (I think originally contributed by @ovr).
   
   This has a few limitations:
   1. It can't be 
   
   
   **Describe the solution you'd like**
   I would like to be able to use the interval type from sql as normal:
   
   ```sql
   select '1 day`::interval
   select cast('1 day' as interval);
   select arrow_cast('1 day', 'Interval(MonthDayNano)');
   ```
   
   Here is what happens today
   ```
   ❯ select '1 day'::interval;
   This feature is not implemented: Unsupported SQL type Interval
   ❯ select cast('1 day' as interval);
   This feature is not implemented: Unsupported SQL type Interval
   ❯ select arrow_cast('1 day', 'Interval(MonthDayNano)');
   Error during planning: Cannot automatically convert Utf8 to 
Interval(MonthDayNano)
   ❯ select arrow_cast('1 day', 'Interval(YearMonth)');
   Error during planning: Cannot automatically convert Utf8 to 
Interval(YearMonth)
   ❯ select arrow_cast('1 day', 'Interval(DayTime)');
   Error during planning: Cannot automatically convert Utf8 to Interval(DayTime)
   ```
   
   
   **Describe alternatives you've considered**
   One thing we need to figure out is what Arrow interval type will map to the 
sql interval type.
   
   Intervals can be either YearMonth or DayTime or MonthDayNano
   
   I think in order to support '1 day' and '1 minute' with the same type, we 
will need to use IntervalMonthDayNano:
   
   
https://docs.rs/arrow/35.0.0/arrow/datatypes/struct.IntervalMonthDayNanoType.html
   
   
   **Additional context**
   I believe the casting support is added upstream in arrow-rs by @doki23  -- 
https://github.com/apache/arrow-rs/pull/3762 in arrow 35.0.0.
   
   However, that upgrade is blocked (see 
https://github.com/apache/arrow-datafusion/pull/5441) so we may have to wait 
for arrow-36.0.0 to implement this feature


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to