Skip to content

Commit 131b9b8

Browse files
committed
Update tChunkedArray/verifyChunkedArray to check the NumNulls property value
1 parent 3a72d30 commit 131b9b8

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

matlab/test/arrow/array/tChunkedArray.m

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,9 @@ function TestIsEqualTrue(testCase)
113113
%
114114
% 1. Their Type properties are equal
115115
% 2. Their NumElements properties are equal
116-
% 3. The same elements are considered null
117-
% 4. All corresponding valid elements have the same values
116+
% 3. Their NumNulls properties are equal
117+
% 4. The same elements are considered null
118+
% 5. All corresponding valid elements have the same values
118119
%
119120
% NOTE: Having the same "chunking" is not a requirement for two
120121
% ChunkedArrays to be equal. ChunkedArrays are considered equal
@@ -204,6 +205,18 @@ function NumElementsNoSetter(testCase)
204205
testCase.verifyError(fcn, "MATLAB:class:SetProhibited");
205206
end
206207

208+
function NumNullsNoSetter(testCase)
209+
% Verify an error is thrown when trying to set the value
210+
% of the NumNulls property.
211+
import arrow.array.ChunkedArray
212+
213+
arrays = {testCase.Float64Array1, testCase.Float64Array2, testCase.Float64Array3};
214+
chunkedArray = ChunkedArray.fromArrays(arrays{:});
215+
216+
fcn = @() setfield(chunkedArray, "NumNulls", int64(100));
217+
testCase.verifyError(fcn, "MATLAB:class:SetProhibited");
218+
end
219+
207220
function ChunkNonNumericIndexError(testCase)
208221
% Verify that an error is thrown when a non-numeric index value
209222
% is provided to the chunk() method.
@@ -476,10 +489,14 @@ function verifyChunkedArray(testCase, chunkedArray, opts)
476489
end
477490
testCase.assertTrue(numel(opts.Arrays) == opts.NumChunks);
478491
allNumElements = cellfun(@(a) a.NumElements, opts.Arrays, UniformOutput=true);
492+
allNumNulls = cellfun(@(a) a.NumNulls, opts.Arrays, UniformOutput=true);
493+
479494
expectedNumElements = int64(sum(allNumElements));
495+
expectedNumNulls = int64(sum(allNumNulls));
480496

481497
testCase.verifyEqual(chunkedArray.NumChunks, opts.NumChunks);
482498
testCase.verifyEqual(chunkedArray.NumElements, expectedNumElements);
499+
testCase.verifyEqual(chunkedArray.NumNulls, expectedNumNulls);
483500
testCase.verifyEqual(chunkedArray.Type, opts.Type);
484501

485502
for ii = 1:opts.NumChunks

0 commit comments

Comments
 (0)