airborne12 commented on code in PR #47846: URL: https://github.com/apache/doris/pull/47846#discussion_r1957852250
########## be/src/olap/rowset/segment_v2/inverted_index_writer.cpp: ########## @@ -325,8 +325,26 @@ class InvertedIndexColumnWriterImpl : public InvertedIndexColumnWriter { return Status::OK(); } - Status add_array_nulls(uint32_t row_id) override { - _null_bitmap.add(row_id); + Status add_array_nulls(const uint8_t* null_map, size_t num_rows) override { + DCHECK(_rid >= num_rows); + if (num_rows == 0 || null_map == nullptr) { + return Status::OK(); + } + std::vector<uint32_t> null_indices; + null_indices.reserve(num_rows / 8); + + // because _rid is the row id in block, not segment, and we add data before we add nulls, + // so we need to subtract num_rows to get the row id in segment + for (size_t i = 0; i < num_rows; i++) { + if (null_map[i] == 1) { + null_indices.push_back(_rid - num_rows + static_cast<uint32_t>(i)); + } + } + + if (!null_indices.empty()) { + _null_bitmap.addMany(null_indices.size(), null_indices.data()); Review Comment: ./benchmark Total number of elements: 10000000 Time taken for individual additions: **116186** microseconds Time taken for batch addition (addMany): **70943** microseconds -- 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