Parse human-readable interval string to Arrow [IntervalDayTimeType]
(
value: &str,
)
| 1024 | |
| 1025 | /// Parse human-readable interval string to Arrow [IntervalDayTimeType] |
| 1026 | pub fn parse_interval_day_time( |
| 1027 | value: &str, |
| 1028 | ) -> Result<<IntervalDayTimeType as ArrowPrimitiveType>::Native, ArrowError> { |
| 1029 | let config = IntervalParseConfig::new(IntervalUnit::Day); |
| 1030 | let interval = Interval::parse(value, &config)?; |
| 1031 | |
| 1032 | let (days, millis) = interval.to_day_time().map_err(|_| ArrowError::CastError(format!( |
| 1033 | "Cannot cast {value} to IntervalDayTime because the nanos part isn't multiple of milliseconds" |
| 1034 | )))?; |
| 1035 | |
| 1036 | Ok(IntervalDayTimeType::make_value(days, millis)) |
| 1037 | } |
| 1038 | |
| 1039 | /// Parse human-readable interval string to Arrow [IntervalMonthDayNanoType] |
| 1040 | pub fn parse_interval_month_day_nano_config( |
nothing calls this directly
no test coverage detected