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

Method import

matlab/src/cpp/arrow/matlab/c/proxy/record_batch_importer.cc:37–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37void RecordBatchImporter::import(libmexclass::proxy::method::Context& context) {
38 namespace mda = ::matlab::data;
39 using namespace libmexclass::proxy;
40 using RecordBatchProxy = arrow::matlab::tabular::proxy::RecordBatch;
41
42 mda::StructArray args = context.inputs[0];
43 const mda::TypedArray<uint64_t> arrow_array_address_mda = args[0]["ArrowArrayAddress"];
44 const mda::TypedArray<uint64_t> arrow_schema_address_mda =
45 args[0]["ArrowSchemaAddress"];
46
47 const auto arrow_array_address = uint64_t(arrow_array_address_mda[0]);
48 const auto arrow_schema_address = uint64_t(arrow_schema_address_mda[0]);
49
50 auto arrow_array = reinterpret_cast<struct ArrowArray*>(arrow_array_address);
51 auto arrow_schema = reinterpret_cast<struct ArrowSchema*>(arrow_schema_address);
52
53 MATLAB_ASSIGN_OR_ERROR_WITH_CONTEXT(auto record_batch,
54 arrow::ImportRecordBatch(arrow_array, arrow_schema),
55 context, error::C_IMPORT_FAILED);
56
57 auto record_batch_proxy = std::make_shared<RecordBatchProxy>(std::move(record_batch));
58
59 mda::ArrayFactory factory;
60 const auto record_batch_proxy_id = ProxyManager::manageProxy(record_batch_proxy);
61 const auto record_batch_proxy_id_mda = factory.createScalar(record_batch_proxy_id);
62
63 context.outputs[0] = record_batch_proxy_id_mda;
64}
65
66} // namespace arrow::matlab::c::proxy

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected