ovr commented on a change in pull request #9373: URL: https://github.com/apache/arrow/pull/9373#discussion_r570532111
########## File path: rust/datafusion/src/sql/planner.rs ########## @@ -982,6 +996,171 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { ))), } } + + fn sql_interval_to_literal( + &self, + value: &str, + leading_field: &Option<DateTimeField>, + leading_precision: &Option<u64>, + last_field: &Option<DateTimeField>, + fractional_seconds_precision: &Option<u64>, + ) -> Result<Expr> { + if leading_field.is_some() { + return Err(DataFusionError::NotImplemented(format!( + "Unsupported Interval Expression with leading_field {:?}", + leading_field + ))); + } + + if leading_precision.is_some() { + return Err(DataFusionError::NotImplemented(format!( + "Unsupported Interval Expression with leading_precision {:?}", + leading_precision + ))); + } + + if last_field.is_some() { + return Err(DataFusionError::NotImplemented(format!( + "Unsupported Interval Expression with last_field {:?}", + last_field + ))); + } + + if fractional_seconds_precision.is_some() { + return Err(DataFusionError::NotImplemented(format!( + "Unsupported Interval Expression with fractional_seconds_precision {:?}", + fractional_seconds_precision + ))); + } + + const SECONDS_PER_HOUR: f32 = 3_600_f32; + const MILLIS_PER_SECOND: f32 = 1_000_f32; + + // We are storing parts as integers, it's why we need to align parts fractional + // INTERVAL '0.5 MONTH' = 15 days, INTERVAL '1.5 MONTH' = 1 month 15 days Review comment: I am trying to achieve similar experience as PostgreSQL in this place. Users who will use this, should know about this thing. > NotImplemented("DF doesnt support complex intervals: \"1.1 month\"") I think, will be great to create an RFC for Apache Arrow to introduce support for `MonthDayTime` interval type, which will help to represent any interval. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org