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(),