Skip to content

Commit d7ac4e0

Browse files
Add Feather V1 deprecation warnings to featherread and featherwrite.
Co-authored-by: Sarah Gilmore <sgilmore@mathworks.com>
1 parent 35fb62e commit d7ac4e0

4 files changed

Lines changed: 45 additions & 0 deletions

File tree

matlab/src/matlab/featherread.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
filename(1, 1) string {mustBeNonmissing, mustBeNonzeroLengthText}
2828
end
2929

30+
warning("arrow:io:feather:v1:FeatherReadDeprecated", ...
31+
"Reading from Feather V1 files is deprecated. Use arrow.io.ipc.RecordBatchFileReader to read from Feather V2 (Arrow IPC) files.");
32+
33+
3034
typesToCast = [arrow.type.ID.UInt8, ...
3135
arrow.type.ID.UInt16, ...
3236
arrow.type.ID.UInt32, ...

matlab/src/matlab/featherwrite.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ function featherwrite(filename, t)
2828
t table
2929
end
3030

31+
warning("arrow:io:feather:v1:FeatherWriteDeprecated", ...
32+
"Writing to Feather V1 files is deprecated. Use arrow.io.ipc.RecordBatchFileWriter to write to Feather V2 (Arrow IPC) files.");
33+
3134
recordBatch = arrow.recordBatch(t);
3235
writer = arrow.internal.io.feather.Writer(filename);
3336
writer.write(recordBatch);

matlab/test/arrow/io/feather/tRoundTrip.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@
1616
% permissions and limitations under the License.
1717
classdef tRoundTrip < matlab.unittest.TestCase
1818

19+
methods(TestMethodSetup)
20+
21+
function suppressFeatherV1Warnings(testCase)
22+
import matlab.unittest.fixtures.SuppressedWarningsFixture
23+
testCase.applyFixture(SuppressedWarningsFixture("arrow:io:feather:v1:FeatherReadDeprecated"));
24+
end
25+
26+
end
27+
1928
methods(Test)
2029
function Basic(testCase)
2130
import matlab.unittest.fixtures.TemporaryFolderFixture

matlab/test/tfeather.m

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ function setupTempWorkingDirectory(testCase)
2222
import matlab.unittest.fixtures.WorkingFolderFixture;
2323
testCase.applyFixture(WorkingFolderFixture);
2424
end
25+
26+
function suppressFeatherV1Warnings(testCase)
27+
import matlab.unittest.fixtures.SuppressedWarningsFixture
28+
testCase.applyFixture(SuppressedWarningsFixture("arrow:io:feather:v1:FeatherReadDeprecated"));
29+
testCase.applyFixture(SuppressedWarningsFixture("arrow:io:feather:v1:FeatherWriteDeprecated"));
30+
end
2531

2632
end
2733

@@ -267,6 +273,29 @@ function UnicodeVariableNames(testCase)
267273
testCase.verifyEqual(actualTable, expectedTable);
268274
end
269275

276+
function VerifyFeatherReadDeprecationWarning(testCase)
277+
filename = fullfile(pwd, 'temp.feather');
278+
279+
t = array2table([1, 2, 3]);
280+
featherwrite(filename, t);
281+
282+
warning("on", "arrow:io:feather:v1:FeatherReadDeprecated");
283+
fcn = @() featherread(filename);
284+
testCase.verifyWarning(fcn, "arrow:io:feather:v1:FeatherReadDeprecated")
285+
warning("off", "arrow:io:feather:v1:FeatherReadDeprecated");
286+
end
287+
288+
function VerifyFeatherWriteDeprecationWarning(testCase)
289+
filename = fullfile(pwd, 'temp.feather');
290+
291+
t = array2table([1, 2, 3]);
292+
293+
warning("on", "arrow:io:feather:v1:FeatherWriteDeprecated");
294+
fcn = @() featherwrite(filename, t);
295+
testCase.verifyWarning(fcn, "arrow:io:feather:v1:FeatherWriteDeprecated")
296+
warning("off", "arrow:io:feather:v1:FeatherReadDeprecated");
297+
end
298+
270299
end
271300
end
272301

0 commit comments

Comments
 (0)