github-actions[bot] commented on code in PR #70774:
URL: https://github.com/apache/doris/pull/70774#discussion_r4661165040
##########
be/src/core/data_type_serde/data_type_bitmap_serde.cpp:
##########
@@ -105,18 +102,14 @@ Status DataTypeBitMapSerDe::read_column_from_pb(IColumn&
column, const PValues&
}
void DataTypeBitMapSerDe::write_one_cell_to_jsonb(const IColumn& column,
JsonbWriter& result,
- Arena& arena, int32_t
col_id, int64_t row_num,
+ Arena&, int32_t col_id,
int64_t row_num,
const FormatOptions&
options) const {
const auto& data_column = assert_cast<const ColumnBitmap&>(column);
result.writeKey(cast_set<JsonbKeyValue::keyid_type>(col_id));
- auto bitmap_value = data_column.get_element(row_num);
- // serialize the content of string
- auto size = bitmap_value.getSizeInBytes();
- // serialize the content of string
- char* ptr = arena.alloc(size);
- bitmap_value.write_to(ptr);
Review Comment:
[P2] Preserve the supplied Arena for this temporary serialized payload. This
method used arena.alloc() before, but the new std::string buffer is allocated
outside Doris's tracked Allocator<false>; large bitmap values returned through
JSONB can bypass query memory accounting and add an avoidable untracked
allocation. Use write_optimized with an arena-backed destination, or copy the
compact bytes into Arena memory, here.
##########
be/src/core/data_type/data_type_bitmap.cpp:
##########
@@ -61,17 +61,12 @@ char* DataTypeBitMap::serialize(const IColumn& column,
char* buf, int be_exec_ve
const auto& data_column = assert_cast<const ColumnBitmap&>(*bitmap_column);
// serialize the bitmap size array
auto* meta_ptr = reinterpret_cast<size_t*>(buf);
- for (size_t i = 0; i < real_need_copy_num; ++i) {
- auto& bitmap = data_column.get_element(i);
- unaligned_store<size_t>(&meta_ptr[i], bitmap.getSizeInBytes());
- }
-
- // serialize each bitmap
char* data_ptr = buf + sizeof(size_t) * real_need_copy_num;
for (size_t i = 0; i < real_need_copy_num; ++i) {
auto& bitmap = data_column.get_element(i);
- bitmap.write_to(data_ptr);
- data_ptr += unaligned_load<size_t>(&meta_ptr[i]);
+ const auto size = bitmap.write_optimized_to(data_ptr);
Review Comment:
[P1] Keep the bitmap size prepass consistent with the compact bytes emitted
here. get_uncompressed_serialized_bytes() still sums getSizeInBytes(), but
getSizeInBytes() no longer optimizes and this call writes write_optimized_to(),
so BITMAP rows (for example the existing 1024-row test) return before buf +
size and fail the exact-size assertions. Compute the compact serialized size
without mutating the source, or otherwise make the reported size and writer
agree, before merging.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]