Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions matlab/src/matlab/+arrow/+internal/+io/+feather/Reader.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@
obj.Proxy = arrow.internal.proxy.create("arrow.io.feather.proxy.Reader", args);
end

function T = read(obj)
function recordBatch = read(obj)
recordBatchProxyID = obj.Proxy.read();
proxy = libmexclass.proxy.Proxy(Name="arrow.tabular.proxy.RecordBatch", ID=recordBatchProxyID);
recordBatch = arrow.tabular.RecordBatch(proxy);
T = recordBatch.toMATLAB();
end

function filename = get.Filename(obj)
Expand Down
5 changes: 2 additions & 3 deletions matlab/src/matlab/+arrow/+internal/+io/+feather/Writer.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@
obj.Proxy = arrow.internal.proxy.create(proxyName, args);
end

function write(obj, T)
rb = arrow.recordbatch(T);
args = struct(RecordBatchProxyID=rb.Proxy.ID);
function write(obj, recordBatch)
args = struct(RecordBatchProxyID=recordBatch.Proxy.ID);
obj.Proxy.write(args);
end

Expand Down
3 changes: 2 additions & 1 deletion matlab/src/matlab/featherwrite.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function featherwrite(filename, t)
t table
end

recordBatch = arrow.recordbatch(t);
writer = arrow.internal.io.feather.Writer(filename);
writer.write(t);
writer.write(recordBatch);
end
30 changes: 15 additions & 15 deletions matlab/test/arrow/io/feather/tRoundTrip.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,27 @@ function addFeatherFunctionsToMATLABPath(testCase)
methods(Test)
function Basic(testCase)
import matlab.unittest.fixtures.TemporaryFolderFixture

import arrow.internal.io.feather.*

fixture = testCase.applyFixture(TemporaryFolderFixture);
filename = fullfile(fixture.Folder, "temp.feather");

DoubleVar = [10; 20; 30; 40];
SingleVar = single([10; 15; 20; 25]);
tWrite = table(DoubleVar, SingleVar);

featherwrite(tWrite, filename);
tRead = featherread(filename);
testCase.verifyEqual(tWrite, tRead);

tableWrite = table(DoubleVar, SingleVar);
recordBatchWrite = arrow.recordbatch(tableWrite);

writer = Writer(filename);
writer.write(recordBatchWrite);

reader = arrow.internal.io.feather.Reader(filename);
recordBatchRead = reader.read();

tableRead = table(recordBatchRead);

testCase.verifyEqual(tableWrite, tableRead);
end
end
end

function featherwrite(T, filename)
writer = arrow.internal.io.feather.Writer(filename);
writer.write(T);
end

function T = featherread(filename)
reader = arrow.internal.io.feather.Reader(filename);
T = reader.read();
end