Skip to content

Commit

Permalink
Add test points for mismatched schema
Browse files Browse the repository at this point in the history
  • Loading branch information
sgilmore10 committed Jun 18, 2024
1 parent c37a11f commit a440597
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions matlab/test/arrow/io/ipc/tRecordBatchFileWriter.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,25 @@ function writeInvalidType(testCase)
fcn = @() writer.write(schema);
testCase.verifyError(fcn, "arrow:matlab:ipc:write:InvalidType");
end

function writeRecordBatchInvalidSchema(testCase)
folder = testCase.setupTemporaryFolder();
fname = fullfile(folder, "data.arrow");
schema = arrow.schema(arrow.field("A", arrow.float64()));
arrowRecordBatch = arrow.recordBatch(table([1 2 3 4]', VariableNames="B"));
writer = arrow.io.ipc.RecordBatchFileWriter(fname, schema);
fcn = @() writer.writeRecordBatch(arrowRecordBatch);
testCase.verifyError(fcn, "arrow:io:ipc:FailedToWriteRecordBatch");
end

function writeTableInvalidSchema(testCase)
folder = testCase.setupTemporaryFolder();
fname = fullfile(folder, "data.arrow");
schema = arrow.schema(arrow.field("A", arrow.float64()));
arrowTable = arrow.table(table([1 2 3 4]', VariableNames="B"));
writer = arrow.io.ipc.RecordBatchFileWriter(fname, schema);
fcn = @() writer.writeTable(arrowTable);
testCase.verifyError(fcn, "arrow:io:ipc:FailedToWriteRecordBatch");
end
end
end

0 comments on commit a440597

Please sign in to comment.