diff --git a/matlab/src/matlab/+arrow/+internal/+io/+feather/Reader.m b/matlab/src/matlab/+arrow/+internal/+io/+feather/Reader.m index 80da7294d2d8d..6cd78646767a7 100644 --- a/matlab/src/matlab/+arrow/+internal/+io/+feather/Reader.m +++ b/matlab/src/matlab/+arrow/+internal/+io/+feather/Reader.m @@ -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) diff --git a/matlab/src/matlab/+arrow/+internal/+io/+feather/Writer.m b/matlab/src/matlab/+arrow/+internal/+io/+feather/Writer.m index 37c785f10a5e3..64872ba4a023c 100644 --- a/matlab/src/matlab/+arrow/+internal/+io/+feather/Writer.m +++ b/matlab/src/matlab/+arrow/+internal/+io/+feather/Writer.m @@ -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 diff --git a/matlab/src/matlab/featherwrite.m b/matlab/src/matlab/featherwrite.m index cc3f45e954ad8..879edd8afc68e 100644 --- a/matlab/src/matlab/featherwrite.m +++ b/matlab/src/matlab/featherwrite.m @@ -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 diff --git a/matlab/test/arrow/io/feather/tRoundTrip.m b/matlab/test/arrow/io/feather/tRoundTrip.m index e735d196c1875..f361a4543b8e4 100644 --- a/matlab/test/arrow/io/feather/tRoundTrip.m +++ b/matlab/test/arrow/io/feather/tRoundTrip.m @@ -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 \ No newline at end of file