Skip to content

Commit

Permalink
Add generic write method to RecordBatchFileWriter
Browse files Browse the repository at this point in the history
  • Loading branch information
sgilmore10 committed Jun 18, 2024
1 parent e8f9043 commit 92d4e0b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions matlab/src/matlab/+arrow/+io/+ipc/RecordBatchFileWriter.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,24 @@ function writeTable(obj, arrowTable)
args = struct(TableProxyID=arrowTable.Proxy.ID);
obj.Proxy.writeTable(args);
end

function write(obj, tabularObj)
arguments
obj(1, 1) arrow.io.ipc.RecordBatchFileWriter
tabularObj(1, 1)
end
if isa(tabularObj, "arrow.tabular.RecordBatch")
args = struct(RecordBatchProxyID=recordBatch.Proxy.ID);
obj.Proxy.writeRecordBatch(args);
elseif isa(tabularObj, "arrow.tabular.Table")
args = struct(TableProxyID=arrowTable.Proxy.ID);
obj.Proxy.writeTable(args);
else
id = "arrow:matlab:ipc:write:InvalidType";
msg = "tabularObj input argument must be an instance of" + ...
"either arrow.tabular.RecordBatch or arrow.tabular.Table.";
error(id, msg);
end
end
end
end

0 comments on commit 92d4e0b

Please sign in to comment.