kou commented on PR #39772:
URL: https://github.com/apache/arrow/pull/39772#issuecomment-1906960877
Wow. This is what I wanted when I wrote #39164.
Could you replace the copy routine in the change with this something like
the following?
```diff
diff --git a/cpp/src/arrow/ipc/read_write_test.cc
b/cpp/src/arrow/ipc/read_write_test.cc
index bd2c2b716d..a462dd2beb 100644
--- a/cpp/src/arrow/ipc/read_write_test.cc
+++ b/cpp/src/arrow/ipc/read_write_test.cc
@@ -1336,31 +1336,11 @@ class CopyCollectListener : public CollectListener {
Status OnRecordBatchWithMetadataDecoded(
RecordBatchWithMetadata record_batch_with_metadata) override {
- auto& record_batch = record_batch_with_metadata.batch;
- for (auto column_data : record_batch->column_data()) {
- ARROW_RETURN_NOT_OK(CopyArrayData(column_data));
- }
+ ARROW_ASSIGN_OR_RAISE(record_batch_with_metadata.batch,
+ CopyBatchTo(record_batch_with_metadata.batch,
+ default_cpu_memory_manager()));
return
CollectListener::OnRecordBatchWithMetadataDecoded(record_batch_with_metadata);
}
-
- private:
- Status CopyArrayData(std::shared_ptr<ArrayData> data) {
- auto& buffers = data->buffers;
- for (size_t i = 0; i < buffers.size(); ++i) {
- auto& buffer = buffers[i];
- if (!buffer) {
- continue;
- }
- ARROW_ASSIGN_OR_RAISE(buffers[i], Buffer::Copy(buffer,
buffer->memory_manager()));
- }
- for (auto child_data : data->child_data) {
- ARROW_RETURN_NOT_OK(CopyArrayData(child_data));
- }
- if (data->dictionary) {
- ARROW_RETURN_NOT_OK(CopyArrayData(data->dictionary));
- }
- return Status::OK();
- }
};
struct StreamDecoderWriterHelper : public StreamWriterHelper {
```
--
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]