From 6953b9dc9e3e2f96120d0f9a778c03f8a7799dd8 Mon Sep 17 00:00:00 2001 From: nameexhaustion Date: Fri, 7 Feb 2025 19:15:31 +1100 Subject: [PATCH] fix: Use microseconds for Unity catalog datetime unit (#21122) --- crates/polars-io/src/catalog/unity/schema.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/polars-io/src/catalog/unity/schema.rs b/crates/polars-io/src/catalog/unity/schema.rs index c4df5632c694..3b3c6a9a74f2 100644 --- a/crates/polars-io/src/catalog/unity/schema.rs +++ b/crates/polars-io/src/catalog/unity/schema.rs @@ -200,7 +200,7 @@ fn parse_type_text(type_text: &str) -> PolarsResult { "double" => Float64, "date" => Date, - "timestamp" | "timestamp_ntz" | "timestamp_ltz" => Datetime(TimeUnit::Nanoseconds, None), + "timestamp" | "timestamp_ntz" | "timestamp_ltz" => Datetime(TimeUnit::Microseconds, None), "string" => String, "binary" => Binary, @@ -290,7 +290,7 @@ fn dtype_to_type_text(dtype: &DataType) -> PolarsResult { Float64 => S!("double"), Date => S!("date"), - Datetime(TimeUnit::Nanoseconds, None) => S!("timestamp_ntz"), + Datetime(TimeUnit::Microseconds, None) => S!("timestamp_ntz"), String => S!("string"), Binary => S!("binary"), @@ -370,7 +370,7 @@ fn dtype_to_type_name(dtype: &DataType) -> PolarsResult { Float64 => S!("DOUBLE"), Date => S!("DATE"), - Datetime(TimeUnit::Nanoseconds, None) => S!("TIMESTAMP_NTZ"), + Datetime(TimeUnit::Microseconds, None) => S!("TIMESTAMP_NTZ"), String => S!("STRING"), Binary => S!("BINARY"), @@ -433,7 +433,7 @@ fn dtype_to_type_json(dtype: &DataType) -> PolarsResult { Float64 => S!("double"), Date => S!("date"), - Datetime(TimeUnit::Nanoseconds, None) => S!("timestamp_ntz"), + Datetime(TimeUnit::Microseconds, None) => S!("timestamp_ntz"), String => S!("string"), Binary => S!("binary"),