Skip to content

Commit 3b3480e

Browse files
committed
add write method
1 parent 6c90bb2 commit 3b3480e

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

matlab/src/cpp/arrow/matlab/io/ipc/proxy/record_batch_file_writer.cc

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@
2525

2626
#include "libmexclass/proxy/ProxyManager.h"
2727

28+
#include <iostream>
29+
2830
namespace arrow::matlab::io::ipc::proxy {
2931

3032
RecordBatchFileWriter::RecordBatchFileWriter(std::shared_ptr<arrow::ipc::RecordBatchWriter> writer) : writer{std::move(writer)} {
31-
REGISTER_METHOD(RecordBatchFileWriter, write_batch);
33+
REGISTER_METHOD(RecordBatchFileWriter, writeBatch);
3234
}
3335

3436
libmexclass::proxy::MakeResult RecordBatchFileWriter::make(
@@ -62,7 +64,7 @@ libmexclass::proxy::MakeResult RecordBatchFileWriter::make(
6264
return std::make_shared<RecordBatchFileWriterProxy>(std::move(writer));
6365
}
6466

65-
void RecordBatchFileWriter::write_batch(libmexclass::proxy::method::Context& context) {
67+
void RecordBatchFileWriter::writeBatch(libmexclass::proxy::method::Context& context) {
6668
namespace mda = ::matlab::data;
6769
using RecordBatchProxy = ::arrow::matlab::tabular::proxy::RecordBatch;
6870

matlab/src/cpp/arrow/matlab/io/ipc/proxy/record_batch_file_writer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class RecordBatchFileWriter : public libmexclass::proxy::Proxy {
3333

3434
protected:
3535

36-
void write_batch(libmexclass::proxy::method::Context& context);
36+
void writeBatch(libmexclass::proxy::method::Context& context);
3737

3838
std::shared_ptr<arrow::ipc::RecordBatchWriter> writer;
3939
};

matlab/src/matlab/+arrow/+io/+ipc/RecordBatchFileWriter.m

+10-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,16 @@
2929
schema(1, 1) arrow.tabular.Schema
3030
end
3131
args = struct(Filename=filename, SchemaProxyID=schema.Proxy.ID);
32-
obj.Proxy = arrow.internal.proxy.create("arrow.io.csv.proxy.TableReader", args);
32+
obj.Proxy = arrow.internal.proxy.create("arrow.io.ipc.proxy.RecordBatchFileWriter", args);
33+
end
34+
35+
function write(obj, recordBatch)
36+
arguments
37+
obj(1, 1) arrow.io.ipc.RecordBatchFileWriter
38+
recordBatch(1, 1) arrow.tabular.RecordBatch
39+
end
40+
args = struct(RecordBatchProxyID=recordBatch.Proxy.ID);
41+
obj.Proxy.writeBatch(args);
3342
end
3443
end
3544
end

0 commit comments

Comments
 (0)