bkietz commented on code in PR #39127:
URL: https://github.com/apache/arrow/pull/39127#discussion_r1420857275
##########
cpp/src/arrow/array/builder_binary.cc:
##########
@@ -80,10 +80,11 @@ Status BinaryViewBuilder::AppendArraySlice(const ArraySpan&
array, int64_t offse
Status BinaryViewBuilder::FinishInternal(std::shared_ptr<ArrayData>* out) {
ARROW_ASSIGN_OR_RAISE(auto null_bitmap,
null_bitmap_builder_.FinishWithLength(length_));
ARROW_ASSIGN_OR_RAISE(auto data, data_builder_.FinishWithLength(length_));
- BufferVector buffers = {null_bitmap, data};
- for (auto&& buffer : data_heap_builder_.Finish()) {
- buffers.push_back(std::move(buffer));
- }
+ ARROW_ASSIGN_OR_RAISE(auto byte_buffers, data_heap_builder_.Finish());
+ BufferVector buffers;
+ buffers.reserve(byte_buffers.size() + 2);
+ buffers.insert(buffers.end(), {null_bitmap, data});
+ buffers.insert(buffers.end(), byte_buffers.begin(), byte_buffers.end());
Review Comment:
```suggestion
BufferVector buffers(byte_buffers.size() + 2);
buffers[0] = std::move(null_bitmap);
buffers[1] = std::move(data);
std::move(byte_buffers.begin(), byte_buffers.end(), byte_buffers.begin() +
2);
```
--
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]