zeroshade commented on code in PR #39772:
URL: https://github.com/apache/arrow/pull/39772#discussion_r1471720147
##########
cpp/src/arrow/array/data.cc:
##########
@@ -140,6 +141,49 @@ std::shared_ptr<ArrayData>
ArrayData::Make(std::shared_ptr<DataType> type, int64
return std::make_shared<ArrayData>(std::move(type), length, null_count,
offset);
}
+namespace {
+template <typename Fn>
+Result<std::shared_ptr<ArrayData>> copy_to_impl(const ArrayData& data,
+ const
std::shared_ptr<MemoryManager>& to,
+ Fn&& copy_fn) {
+ auto output = ArrayData::Make(data.type, data.length, data.null_count,
data.offset);
+ output->buffers.reserve(data.buffers.size());
+
+ for (const auto& buf : data.buffers) {
+ if (!buf) {
+ output->buffers.push_back(nullptr);
+ continue;
+ }
+
+ ARROW_ASSIGN_OR_RAISE(auto temp_buf, copy_fn(buf, to));
+ output->buffers.push_back(std::move(temp_buf));
+ }
Review Comment:
I didn't remember we had a zip construct! Thanks, i'll do this
--
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]