| 35 | } |
| 36 | |
| 37 | void 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 |
nothing calls this directly
no outgoing calls
no test coverage detected