felipecrv commented on code in PR #35345:
URL: https://github.com/apache/arrow/pull/35345#discussion_r1384079401
##########
cpp/src/arrow/array/concatenate.cc:
##########
@@ -113,33 +122,30 @@ Status ConcatenateOffsets(const BufferVector& buffers,
MemoryPool* pool,
values_ranges->resize(buffers.size());
// allocate output buffer
- int64_t out_length = 0;
- for (const auto& buffer : buffers) {
- out_length += buffer->size() / sizeof(Offset);
- }
- ARROW_ASSIGN_OR_RAISE(*out, AllocateBuffer((out_length + 1) *
sizeof(Offset), pool));
- auto dst = reinterpret_cast<Offset*>((*out)->mutable_data());
+ const int64_t out_size_in_bytes = SumBufferSizesInBytes(buffers);
+ ARROW_ASSIGN_OR_RAISE(*out, AllocateBuffer(sizeof(Offset) +
out_size_in_bytes, pool));
Review Comment:
Yes. This is used only for lists. Not list-views and lists need one extra
offset.
--
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]