From ee5c820b543e1a02dc3f430715700bb312ad69a9 Mon Sep 17 00:00:00 2001 From: gdliu3 Date: Fri, 26 Jul 2024 13:53:32 +0800 Subject: [PATCH] 1 --- .../serde/data_type_datetimev2_serde.cpp | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/be/src/vec/data_types/serde/data_type_datetimev2_serde.cpp b/be/src/vec/data_types/serde/data_type_datetimev2_serde.cpp index b55d0d4d6ec97ba..383fbeef9e17f8c 100644 --- a/be/src/vec/data_types/serde/data_type_datetimev2_serde.cpp +++ b/be/src/vec/data_types/serde/data_type_datetimev2_serde.cpp @@ -117,19 +117,22 @@ void DataTypeDateTimeV2SerDe::write_column_to_arrow(const IColumn& column, const if (scale > 3) { uint32_t microsecond = datetime_val.microsecond(); timestamp = (timestamp * 1000000) + microsecond; - timestamp -= std::chrono::duration_cast(cctz::convert(cctz::civil_second(1970, 1, 1, 0, 0, 0), ctz) - .time_since_epoch()) - .count(); + timestamp -= std::chrono::duration_cast( + cctz::convert(cctz::civil_second(1970, 1, 1, 0, 0, 0), ctz) + .time_since_epoch()) + .count(); } else if (scale > 0) { uint32_t millisecond = datetime_val.microsecond() / 1000; timestamp = (timestamp * 1000) + millisecond; - timestamp -= std::chrono::duration_cast(cctz::convert(cctz::civil_second(1970, 1, 1, 0, 0, 0), ctz) - .time_since_epoch()) - .count(); - } else if (scale == 0){ - timestamp -= std::chrono::duration_cast(cctz::convert(cctz::civil_second(1970, 1, 1, 0, 0, 0), ctz) - .time_since_epoch()) - .count(); + timestamp -= std::chrono::duration_cast( + cctz::convert(cctz::civil_second(1970, 1, 1, 0, 0, 0), ctz) + .time_since_epoch()) + .count(); + } else if (scale == 0) { + timestamp -= std::chrono::duration_cast( + cctz::convert(cctz::civil_second(1970, 1, 1, 0, 0, 0), ctz) + .time_since_epoch()) + .count(); } checkArrowStatus(timestamp_builder.Append(timestamp), column.get_name(),