From 14f646e601524b42a8f13e2945f68bd11dceea18 Mon Sep 17 00:00:00 2001 From: Neville Dipale Date: Mon, 15 Mar 2021 23:02:25 +0200 Subject: [PATCH] revert timeszone change --- rust/parquet/src/arrow/schema.rs | 36 +++++++++++++------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/rust/parquet/src/arrow/schema.rs b/rust/parquet/src/arrow/schema.rs index cd54e69db75bc..acaf09b971546 100644 --- a/rust/parquet/src/arrow/schema.rs +++ b/rust/parquet/src/arrow/schema.rs @@ -385,27 +385,21 @@ fn arrow_to_parquet_type(field: &Field) -> Result { DataType::Float64 => Type::primitive_type_builder(name, PhysicalType::DOUBLE) .with_repetition(repetition) .build(), - DataType::Timestamp(time_unit, _) => { - Type::primitive_type_builder(name, PhysicalType::INT64) - .with_logical_type(Some(LogicalType::TIMESTAMP(TimestampType { - // Logic to adjust timestamps not yet implemented - is_adjusted_to_u_t_c: false, - unit: match time_unit { - TimeUnit::Second => ParquetTimeUnit::MILLIS(Default::default()), - TimeUnit::Millisecond => { - ParquetTimeUnit::MILLIS(Default::default()) - } - TimeUnit::Microsecond => { - ParquetTimeUnit::MICROS(Default::default()) - } - TimeUnit::Nanosecond => { - ParquetTimeUnit::NANOS(Default::default()) - } - }, - }))) - .with_repetition(repetition) - .build() - } + DataType::Timestamp(time_unit, zone) => Type::primitive_type_builder( + name, + PhysicalType::INT64, + ) + .with_logical_type(Some(LogicalType::TIMESTAMP(TimestampType { + is_adjusted_to_u_t_c: matches!(zone, Some(z) if !z.as_str().is_empty()), + unit: match time_unit { + TimeUnit::Second => ParquetTimeUnit::MILLIS(Default::default()), + TimeUnit::Millisecond => ParquetTimeUnit::MILLIS(Default::default()), + TimeUnit::Microsecond => ParquetTimeUnit::MICROS(Default::default()), + TimeUnit::Nanosecond => ParquetTimeUnit::NANOS(Default::default()), + }, + }))) + .with_repetition(repetition) + .build(), DataType::Date32 => Type::primitive_type_builder(name, PhysicalType::INT32) .with_logical_type(Some(LogicalType::DATE(Default::default()))) .with_repetition(repetition)