From 6c8b9b7c94f2a88436148b5bb425688c7fdd84ad Mon Sep 17 00:00:00 2001 From: Weijie Guo Date: Thu, 21 Sep 2023 01:50:14 +0800 Subject: [PATCH] docs(rust): fix un-compilable rust example in user guide. (#11214) --- docs/src/rust/user-guide/expressions/casting.rs | 1 + docs/src/rust/user-guide/transformations/time-series/filter.rs | 2 +- .../src/rust/user-guide/transformations/time-series/parsing.rs | 3 ++- .../rust/user-guide/transformations/time-series/timezones.rs | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/src/rust/user-guide/expressions/casting.rs b/docs/src/rust/user-guide/expressions/casting.rs index 2dda1e185215..eae6bd520c65 100644 --- a/docs/src/rust/user-guide/expressions/casting.rs +++ b/docs/src/rust/user-guide/expressions/casting.rs @@ -191,6 +191,7 @@ fn main() -> Result<(), Box> { col("string").str().strptime( DataType::Datetime(TimeUnit::Microseconds, None), StrptimeOptions::default(), + lit("raise"), ), ]) .collect()?; diff --git a/docs/src/rust/user-guide/transformations/time-series/filter.rs b/docs/src/rust/user-guide/transformations/time-series/filter.rs index 6e5b2175b81c..95cca184a068 100644 --- a/docs/src/rust/user-guide/transformations/time-series/filter.rs +++ b/docs/src/rust/user-guide/transformations/time-series/filter.rs @@ -45,7 +45,7 @@ fn main() -> Result<(), Box> { .with_column( col("ts") .str() - .strptime(DataType::Date, StrptimeOptions::default()), + .strptime(DataType::Date, StrptimeOptions::default(), lit("raise")), ) .collect()?; diff --git a/docs/src/rust/user-guide/transformations/time-series/parsing.rs b/docs/src/rust/user-guide/transformations/time-series/parsing.rs index 275ed0bf0e6a..1ab4bddf8ba5 100644 --- a/docs/src/rust/user-guide/transformations/time-series/parsing.rs +++ b/docs/src/rust/user-guide/transformations/time-series/parsing.rs @@ -25,7 +25,7 @@ fn main() -> Result<(), Box> { .lazy() .with_columns([col("Date") .str() - .strptime(DataType::Date, StrptimeOptions::default())]) + .strptime(DataType::Date, StrptimeOptions::default(), lit("raise"))]) .collect()?; println!("{}", &df); // --8<-- [end:cast] @@ -63,6 +63,7 @@ fn main() -> Result<(), Box> { format: Some("%Y-%m-%dT%H:%M:%S%z".to_string()), ..Default::default() }, + lit("raise"), ) .dt() .convert_time_zone("Europe/Brussels".to_string()); diff --git a/docs/src/rust/user-guide/transformations/time-series/timezones.rs b/docs/src/rust/user-guide/transformations/time-series/timezones.rs index 20f818954667..6bc846f199be 100644 --- a/docs/src/rust/user-guide/transformations/time-series/timezones.rs +++ b/docs/src/rust/user-guide/transformations/time-series/timezones.rs @@ -11,6 +11,7 @@ fn main() -> Result<(), Box> { .select([col("tz_naive").str().strptime( DataType::Datetime(TimeUnit::Milliseconds, None), StrptimeOptions::default(), + lit("raise"), )]) .with_columns([col("tz_naive") .dt()