Skip to content

Commit 52c7ded

Browse files
committed
Add close method
1 parent fed62c3 commit 52c7ded

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ namespace arrow::matlab::io::ipc::proxy {
3131

3232
RecordBatchFileWriter::RecordBatchFileWriter(std::shared_ptr<arrow::ipc::RecordBatchWriter> writer) : writer{std::move(writer)} {
3333
REGISTER_METHOD(RecordBatchFileWriter, writeBatch);
34+
REGISTER_METHOD(RecordBatchFileWriter, close);
35+
3436
}
3537

3638
libmexclass::proxy::MakeResult RecordBatchFileWriter::make(
@@ -79,4 +81,12 @@ libmexclass::proxy::MakeResult RecordBatchFileWriter::make(
7981

8082
MATLAB_ERROR_IF_NOT_OK_WITH_CONTEXT(writer->WriteRecordBatch(*record_batch), context, "arrow:matlab:writefailed");
8183
}
84+
85+
void RecordBatchFileWriter::close(libmexclass::proxy::method::Context& context) {
86+
namespace mda = ::matlab::data;
87+
using RecordBatchProxy = ::arrow::matlab::tabular::proxy::RecordBatch;
88+
89+
MATLAB_ERROR_IF_NOT_OK_WITH_CONTEXT(writer->Close(), context, "arrow:matlab:ipc:close");
90+
91+
}
8292
} // namespace arrow::matlab::io::ipc::proxy

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@ class RecordBatchFileWriter : public libmexclass::proxy::Proxy {
3434
protected:
3535

3636
void writeBatch(libmexclass::proxy::method::Context& context);
37-
37+
38+
void close(libmexclass::proxy::method::Context& context);
39+
3840
std::shared_ptr<arrow::ipc::RecordBatchWriter> writer;
41+
3942
};
4043

4144
} // namespace arrow::matlab::io::ipc::proxy

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ function write(obj, recordBatch)
4646
obj.Proxy.writeBatch(args);
4747
end
4848

49+
function close(obj)
50+
arguments
51+
obj(1, 1) arrow.io.ipc.RecordBatchFileWriter
52+
end
53+
obj.Proxy.close();
54+
end
55+
4956
end
5057

5158
end

0 commit comments

Comments
 (0)