Skip to content

Commit

Permalink
branch-3.0: [fix](arrow-flight-sql) Fix Doris NULL column conversion …
Browse files Browse the repository at this point in the history
…to arrow batch #43929 (#44231)

Cherry-picked from #43929

Co-authored-by: Xinyi Zou <[email protected]>
  • Loading branch information
github-actions[bot] and xinyiZzz authored Dec 3, 2024
1 parent 6e04545 commit 3879940
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions be/src/vec/data_types/serde/data_type_number_serde.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,21 @@ void DataTypeNumberSerDe<T>::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<T, UInt8>) {
ARROW_BUILDER_TYPE& builder = assert_cast<ARROW_BUILDER_TYPE&>(*array_builder);
checkArrowStatus(
builder.AppendValues(reinterpret_cast<const uint8_t*>(col_data.data() + start),
end - start,
reinterpret_cast<const uint8_t*>(arrow_null_map_data)),
column.get_name(), array_builder->type()->name());
auto* null_builder = dynamic_cast<arrow::NullBuilder*>(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<ARROW_BUILDER_TYPE&>(*array_builder);
checkArrowStatus(
builder.AppendValues(reinterpret_cast<const uint8_t*>(col_data.data() + start),
end - start,
reinterpret_cast<const uint8_t*>(arrow_null_map_data)),
column.get_name(), array_builder->type()->name());
}

} else if constexpr (std::is_same_v<T, Int128>) {
auto& string_builder = assert_cast<arrow::StringBuilder&>(*array_builder);
for (size_t i = start; i < end; ++i) {
Expand Down

0 comments on commit 3879940

Please sign in to comment.