MCPcopy Create free account
hub / github.com/apache/arrow-rs / parse_interval_day_time

Function parse_interval_day_time

arrow-cast/src/parse.rs:1026–1037  ·  view source on GitHub ↗

Parse human-readable interval string to Arrow [IntervalDayTimeType]

(
    value: &str,
)

Source from the content-addressed store, hash-verified

1024
1025/// Parse human-readable interval string to Arrow [IntervalDayTimeType]
1026pub 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]
1040pub fn parse_interval_month_day_nano_config(

Callers

nothing calls this directly

Calls 2

to_day_timeMethod · 0.80
parseFunction · 0.50

Tested by

no test coverage detected