bkietz commented on code in PR #35628:
URL: https://github.com/apache/arrow/pull/35628#discussion_r1231444641
##########
cpp/src/arrow/array/concatenate.cc:
##########
@@ -229,6 +229,43 @@ class ConcatenateImpl {
return ConcatenateBuffers(value_buffers, pool_).Value(&out_->buffers[2]);
}
+ Status Visit(const BinaryViewType& type) {
+ out_->buffers.resize(2);
+
+ for (const auto& in_data : in_) {
+ auto begin = in_data->buffers.begin() + 2;
+ auto end = in_data->buffers.end();
+
+ for (auto it = begin; it != end; ++it) {
+ out_->buffers.push_back(*it);
+ }
+ }
+
+ ARROW_ASSIGN_OR_RAISE(auto header_buffers, Buffers(1,
sizeof(StringHeader)));
+ ARROW_ASSIGN_OR_RAISE(auto header_buffer,
ConcatenateBuffers(header_buffers, pool_));
+
+ if (!type.has_raw_pointers()) {
+ auto* s = header_buffer->mutable_data_as<StringHeader>();
+
+ size_t preceding_buffer_count = 0;
+
+ int64_t i = in_[0]->length;
+ for (size_t in_index = 1; in_index < in_.size(); ++in_index) {
+ preceding_buffer_count += in_[in_index - 1]->buffers.size() - 2;
+
+ for (int64_t end_i = i + in_[in_index]->length; i < end_i; ++i) {
+ if (s[i].IsInline()) continue;
+ auto buffer_index =
+ static_cast<uint32_t>(s[i].GetBufferIndex() +
preceding_buffer_count);
+ s[i].SetIndexOffset(buffer_index, s[i].GetBufferOffset());
+ }
+ }
+ }
+
+ out_->buffers[1] = std::move(header_buffer);
Review Comment:
That's handled before the VisitTypeInline call
--
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]