diff --git a/be/src/vec/data_types/serde/data_type_number_serde.cpp b/be/src/vec/data_types/serde/data_type_number_serde.cpp index efa41e346bfa6e..f4fb6bbbb1f9cf 100644 --- a/be/src/vec/data_types/serde/data_type_number_serde.cpp +++ b/be/src/vec/data_types/serde/data_type_number_serde.cpp @@ -78,12 +78,21 @@ void DataTypeNumberSerDe::write_column_to_arrow(const IColumn& column, const auto arrow_null_map = revert_null_map(null_map, start, end); auto arrow_null_map_data = arrow_null_map.empty() ? nullptr : arrow_null_map.data(); if constexpr (std::is_same_v) { - ARROW_BUILDER_TYPE& builder = assert_cast(*array_builder); - checkArrowStatus( - builder.AppendValues(reinterpret_cast(col_data.data() + start), - end - start, - reinterpret_cast(arrow_null_map_data)), - column.get_name(), array_builder->type()->name()); + auto* null_builder = dynamic_cast(array_builder); + if (null_builder) { + for (size_t i = start; i < end; ++i) { + checkArrowStatus(null_builder->AppendNull(), column.get_name(), + null_builder->type()->name()); + } + } else { + ARROW_BUILDER_TYPE& builder = assert_cast(*array_builder); + checkArrowStatus( + builder.AppendValues(reinterpret_cast(col_data.data() + start), + end - start, + reinterpret_cast(arrow_null_map_data)), + column.get_name(), array_builder->type()->name()); + } + } else if constexpr (std::is_same_v) { auto& string_builder = assert_cast(*array_builder); for (size_t i = start; i < end; ++i) {