MCPcopy Create free account
hub / github.com/apache/datafusion / try_from

Method try_from

datafusion/common/src/config.rs:1391–1413  ·  view source on GitHub ↗
(options: &'a FormatOptions)

Source from the content-addressed store, hash-verified

1389impl<'a> TryFrom<&'a FormatOptions> for arrow::util::display::FormatOptions<'a> {
1390 type Error = DataFusionError;
1391 fn try_from(options: &'a FormatOptions) -> Result<Self> {
1392 let duration_format = match options.duration_format.as_str() {
1393 "pretty" => arrow::util::display::DurationFormat::Pretty,
1394 "iso8601" => arrow::util::display::DurationFormat::ISO8601,
1395 _ => {
1396 return _config_err!(
1397 "Invalid duration format: {}. Valid values are pretty or iso8601",
1398 options.duration_format
1399 );
1400 }
1401 };
1402
1403 Ok(Self::new()
1404 .with_display_error(options.safe)
1405 .with_null(&options.null)
1406 .with_date_format(options.date_format.as_deref())
1407 .with_datetime_format(options.datetime_format.as_deref())
1408 .with_timestamp_format(options.timestamp_format.as_deref())
1409 .with_timestamp_tz_format(options.timestamp_tz_format.as_deref())
1410 .with_time_format(options.time_format.as_deref())
1411 .with_duration_format(duration_format)
1412 .with_types_info(options.types_info))
1413 }
1414}
1415
1416/// A key value pair, with a corresponding description

Callers

nothing calls this directly

Calls 11

newFunction · 0.85
as_strMethod · 0.45
is_emptyMethod · 0.45
iterMethod · 0.45
mapMethod · 0.45
as_refMethod · 0.45
buildMethod · 0.45
pushMethod · 0.45
cloneMethod · 0.45
insertMethod · 0.45
clonedMethod · 0.45

Tested by

no test coverage detected