File tree 3 files changed +23
-1
lines changed
matlab/src/cpp/arrow/matlab
3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -242,5 +242,6 @@ static const char* ARRAY_SLICE_FAILED_TO_CREATE_ARRAY_PROXY =
242
242
" arrow:array:slice:FailedToCreateArrayProxy" ;
243
243
static const char * C_EXPORT_FAILED = " arrow:c:export:ExportFailed" ;
244
244
static const char * C_IMPORT_FAILED = " arrow:c:import:ImportFailed" ;
245
+ static const char * IPC_RECORD_BATCH_WRITE_FAILED = " arrow:io:ipc:FailedToWriteRecordBatch" ;
245
246
246
247
} // namespace arrow::matlab::error
Original file line number Diff line number Diff line change 28
28
namespace arrow ::matlab::io::ipc::proxy {
29
29
30
30
RecordBatchFileWriter::RecordBatchFileWriter (const std::shared_ptr<arrow::ipc::RecordBatchWriter> writer)
31
- : writer{std::move (writer)} {}
31
+ : writer{std::move (writer)} {
32
+ REGISTER_METHOD (RecordBatchFileWriter, writeRecordBatch);
33
+ }
32
34
33
35
libmexclass::proxy::MakeResult RecordBatchFileWriter::make (const libmexclass::proxy::FunctionArguments& constructor_arguments) {
34
36
namespace mda = ::matlab::data;
@@ -59,4 +61,20 @@ libmexclass::proxy::MakeResult RecordBatchFileWriter::make(const libmexclass::pr
59
61
return std::make_shared<RecordBatchFileWriterProxy>(std::move (writer));
60
62
}
61
63
64
+ void RecordBatchFileWriter::writeRecordBatch (libmexclass::proxy::method::Context& context) {
65
+ namespace mda = ::matlab::data;
66
+ using RecordBatchProxy = ::arrow::matlab::tabular::proxy::RecordBatch;
67
+
68
+ mda::StructArray opts = context.inputs [0 ];
69
+ const mda::TypedArray<uint64_t > record_batch_proxy_id_mda = opts[0 ][" RecordBatchProxyID" ];
70
+ const uint64_t record_batch_proxy_id = record_batch_proxy_id_mda[0 ];
71
+
72
+ auto proxy = libmexclass::proxy::ProxyManager::getProxy (record_batch_proxy_id);
73
+ auto record_batch_proxy = std::static_pointer_cast<RecordBatchProxy>(proxy);
74
+ auto record_batch = record_batch_proxy->unwrap ();
75
+
76
+ MATLAB_ERROR_IF_NOT_OK_WITH_CONTEXT (writer->WriteRecordBatch (*record_batch),
77
+ context, error::IPC_RECORD_BATCH_WRITE_FAILED);
78
+ }
79
+
62
80
} // namespace arrow::matlab::io::ipc::proxy
Original file line number Diff line number Diff line change @@ -30,6 +30,9 @@ class RecordBatchFileWriter : public libmexclass::proxy::Proxy {
30
30
31
31
protected:
32
32
std::shared_ptr<arrow::ipc::RecordBatchWriter> writer;
33
+
34
+ void writeRecordBatch (libmexclass::proxy::method::Context& context);
35
+
33
36
};
34
37
35
38
} // namespace arrow::matlab::io::ipc::proxy
You can’t perform that action at this time.
0 commit comments