MCPcopy Create free account
hub / github.com/apache/arrow / CopyBatchToHost

Function CopyBatchToHost

cpp/src/arrow/flight/test_definitions.cc:1221–1238  ·  view source on GitHub ↗

Copy a record batch to host memory.

Source from the content-addressed store, hash-verified

1219
1220// Copy a record batch to host memory.
1221arrow::Result<std::shared_ptr<RecordBatch>> CopyBatchToHost(const RecordBatch& batch) {
1222 auto mm = CPUDevice::Instance()->default_memory_manager();
1223 ArrayVector arrays;
1224 for (const auto& column : batch.columns()) {
1225 std::shared_ptr<ArrayData> data = column->data()->Copy();
1226 if (data->child_data.size() != 0) {
1227 return Status::NotImplemented("Nested arrays");
1228 }
1229
1230 for (size_t i = 0; i < data->buffers.size(); i++) {
1231 const auto& buffer = data->buffers[i];
1232 if (!buffer || buffer->is_cpu()) continue;
1233 ARROW_ASSIGN_OR_RAISE(data->buffers[i], Buffer::Copy(buffer, mm));
1234 }
1235 arrays.push_back(MakeArray(data));
1236 }
1237 return RecordBatch::Make(batch.schema(), batch.num_rows(), std::move(arrays));
1238}
1239
1240class CudaTestServer : public FlightServerBase {
1241 public:

Callers

nothing calls this directly

Calls 13

columnsMethod · 0.80
push_backMethod · 0.80
ARROW_ASSIGN_OR_RAISEFunction · 0.70
NotImplementedFunction · 0.50
CopyFunction · 0.50
MakeArrayFunction · 0.50
MakeFunction · 0.50
CopyMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
schemaMethod · 0.45

Tested by

no test coverage detected