github-actions[bot] commented on code in PR #26709: URL: https://github.com/apache/doris/pull/26709#discussion_r1404707056
########## be/src/vec/data_types/serde/data_type_datetimev2_serde.cpp: ########## @@ -112,6 +113,52 @@ } } +void DataTypeDateTimeV2SerDe::read_column_from_arrow(IColumn& column, + const arrow::Array* arrow_array, int start, + int end, const cctz::time_zone& ctz) const { + auto& col_data = static_cast<ColumnVector<Int64>&>(column).get_data(); + int64_t divisor = 1; + if (arrow_array->type()->id() == arrow::Type::TIMESTAMP) { + auto concrete_array = dynamic_cast<const arrow::TimestampArray*>(arrow_array); + const auto type = std::static_pointer_cast<arrow::TimestampType>(arrow_array->type()); + switch (type->unit()) { + case arrow::TimeUnit::type::SECOND: { + divisor = 1; + break; + } + case arrow::TimeUnit::type::MILLI: { + divisor = 1000; Review Comment: warning: 1000 is a magic number; consider replacing it with a named constant [readability-magic-numbers] ```cpp divisor = 1000; ^ ``` ########## be/src/vec/data_types/serde/data_type_datetimev2_serde.cpp: ########## @@ -112,6 +113,52 @@ void DataTypeDateTimeV2SerDe::write_column_to_arrow(const IColumn& column, const } } +void DataTypeDateTimeV2SerDe::read_column_from_arrow(IColumn& column, Review Comment: warning: method 'read_column_from_arrow' can be made static [readability-convert-member-functions-to-static] ```suggestion static void DataTypeDateTimeV2SerDe::read_column_from_arrow(IColumn& column, ``` be/src/vec/data_types/serde/data_type_datetimev2_serde.cpp:117: ```diff - int end, const cctz::time_zone& ctz) const { + int end, const cctz::time_zone& ctz) { ``` ########## be/src/vec/data_types/serde/data_type_datetimev2_serde.cpp: ########## @@ -112,6 +113,52 @@ } } +void DataTypeDateTimeV2SerDe::read_column_from_arrow(IColumn& column, + const arrow::Array* arrow_array, int start, + int end, const cctz::time_zone& ctz) const { + auto& col_data = static_cast<ColumnVector<Int64>&>(column).get_data(); + int64_t divisor = 1; + if (arrow_array->type()->id() == arrow::Type::TIMESTAMP) { + auto concrete_array = dynamic_cast<const arrow::TimestampArray*>(arrow_array); + const auto type = std::static_pointer_cast<arrow::TimestampType>(arrow_array->type()); + switch (type->unit()) { + case arrow::TimeUnit::type::SECOND: { + divisor = 1; + break; + } + case arrow::TimeUnit::type::MILLI: { + divisor = 1000; + break; + } + case arrow::TimeUnit::type::MICRO: { + divisor = 1000000; + break; + } + case arrow::TimeUnit::type::NANO: { + divisor = 1000000000; Review Comment: warning: 1000000000 is a magic number; consider replacing it with a named constant [readability-magic-numbers] ```cpp divisor = 1000000000; ^ ``` ########## be/src/vec/data_types/serde/data_type_datetimev2_serde.cpp: ########## @@ -112,6 +113,52 @@ } } +void DataTypeDateTimeV2SerDe::read_column_from_arrow(IColumn& column, + const arrow::Array* arrow_array, int start, + int end, const cctz::time_zone& ctz) const { + auto& col_data = static_cast<ColumnVector<Int64>&>(column).get_data(); + int64_t divisor = 1; + if (arrow_array->type()->id() == arrow::Type::TIMESTAMP) { + auto concrete_array = dynamic_cast<const arrow::TimestampArray*>(arrow_array); + const auto type = std::static_pointer_cast<arrow::TimestampType>(arrow_array->type()); + switch (type->unit()) { + case arrow::TimeUnit::type::SECOND: { + divisor = 1; + break; + } + case arrow::TimeUnit::type::MILLI: { + divisor = 1000; + break; + } + case arrow::TimeUnit::type::MICRO: { + divisor = 1000000; Review Comment: warning: 1000000 is a magic number; consider replacing it with a named constant [readability-magic-numbers] ```cpp divisor = 1000000; ^ ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org