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

Method write

matlab/src/cpp/arrow/matlab/io/feather/proxy/writer.cc:62–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62void Writer::write(libmexclass::proxy::method::Context& context) {
63 namespace mda = ::matlab::data;
64 mda::StructArray opts = context.inputs[0];
65 const mda::TypedArray<uint64_t> record_batch_proxy_id_mda =
66 opts[0]["RecordBatchProxyID"];
67 const uint64_t record_batch_proxy_id = record_batch_proxy_id_mda[0];
68
69 auto proxy = libmexclass::proxy::ProxyManager::getProxy(record_batch_proxy_id);
70 auto record_batch_proxy =
71 std::static_pointer_cast<arrow::matlab::tabular::proxy::RecordBatch>(proxy);
72 auto record_batch = record_batch_proxy->unwrap();
73
74 MATLAB_ASSIGN_OR_ERROR_WITH_CONTEXT(const auto table,
75 arrow::Table::FromRecordBatches({record_batch}),
76 context, error::TABLE_FROM_RECORD_BATCH);
77
78 MATLAB_ASSIGN_OR_ERROR_WITH_CONTEXT(
79 std::shared_ptr<arrow::io::OutputStream> output_stream,
80 arrow::io::FileOutputStream::Open(filename), context,
81 error::FAILED_TO_OPEN_FILE_FOR_WRITE);
82
83 // Specify the feather file format version as V1
84 arrow::ipc::feather::WriteProperties write_props;
85 write_props.version = arrow::ipc::feather::kFeatherV1Version;
86
87 MATLAB_ERROR_IF_NOT_OK_WITH_CONTEXT(
88 ipc::feather::WriteTable(*table, output_stream.get(), write_props), context,
89 error::FEATHER_FAILED_TO_WRITE_TABLE);
90}
91} // namespace arrow::matlab::io::feather::proxy

Callers

nothing calls this directly

Calls 3

WriteTableFunction · 0.50
unwrapMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected