Skip to content

Commit

Permalink
Use NumElements instead of Length property of ChunkedArray in tTable
Browse files Browse the repository at this point in the history
  • Loading branch information
sgilmore10 committed Oct 10, 2023
1 parent dd6f557 commit 35b7287
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions matlab/test/arrow/tabular/tTable.m
Original file line number Diff line number Diff line change
Expand Up @@ -208,32 +208,32 @@ function GetColumnByName(testCase)

column = arrowTable.column("A");
expectedNumChunks = int32(1);
expectedLength = int64(3);
expectedNumElements = int64(3);
expectedArrowType = arrow.float64();
testCase.verifyChunkedArray(column, ...
matlabArray1, ...
expectedNumChunks, ...
expectedLength, ...
expectedNumElements, ...
expectedArrowType);

column = arrowTable.column("B");
expectedNumChunks = int32(1);
expectedLength = int64(3);
expectedNumElements = int64(3);
expectedArrowType = arrow.string();
testCase.verifyChunkedArray(column, ...
matlabArray2, ...
expectedNumChunks, ...
expectedLength, ...
expectedNumElements, ...
expectedArrowType);

column = arrowTable.column("C");
expectedNumChunks = int32(1);
expectedLength = int64(3);
expectedNumElements = int64(3);
expectedArrowType = arrow.boolean();
testCase.verifyChunkedArray(column, ...
matlabArray3, ...
expectedNumChunks, ...
expectedLength, ...
expectedNumElements, ...
expectedArrowType);
end

Expand All @@ -257,12 +257,12 @@ function GetColumnByNameWithEmptyString(testCase)

column = arrowTable.column("");
expectedNumChunks = int32(1);
expectedLength = int64(3);
expectedNumElements = int64(3);
expectedArrowType = arrow.string();
testCase.verifyChunkedArray(column, ...
matlabArray2, ...
expectedNumChunks, ...
expectedLength, ...
expectedNumElements, ...
expectedArrowType);
end

Expand All @@ -286,32 +286,32 @@ function GetColumnByNameWithWhitespace(testCase)

column = arrowTable.column(" ");
expectedNumChunks = int32(1);
expectedLength = int64(3);
expectedNumElements = int64(3);
expectedArrowType = arrow.float64();
testCase.verifyChunkedArray(column, ...
matlabArray1, ...
expectedNumChunks, ...
expectedLength, ...
expectedNumElements, ...
expectedArrowType);

column = arrowTable.column(" ");
expectedNumChunks = int32(1);
expectedLength = int64(3);
expectedNumElements = int64(3);
expectedArrowType = arrow.string();
testCase.verifyChunkedArray(column, ...
matlabArray2, ...
expectedNumChunks, ...
expectedLength, ...
expectedNumElements, ...
expectedArrowType);

column = arrowTable.column(" ");
expectedNumChunks = int32(1);
expectedLength = int64(3);
expectedNumElements = int64(3);
expectedArrowType = arrow.boolean();
testCase.verifyChunkedArray(column, ...
matlabArray3, ...
expectedNumChunks, ...
expectedLength, ...
expectedNumElements, ...
expectedArrowType);
end

Expand Down Expand Up @@ -392,58 +392,58 @@ function GetColumnByNameWithChar(testCase)
name = char.empty(0, 0);
column = arrowTable.column(name);
expectedNumChunks = int32(1);
expectedLength = int64(3);
expectedNumElements = int64(3);
expectedArrowType = arrow.float64();
testCase.verifyChunkedArray(column, ...
matlabArray1, ...
expectedNumChunks, ...
expectedLength, ...
expectedNumElements, ...
expectedArrowType);

name = char.empty(0, 1);
column = arrowTable.column(name);
expectedNumChunks = int32(1);
expectedLength = int64(3);
expectedNumElements = int64(3);
expectedArrowType = arrow.float64();
testCase.verifyChunkedArray(column, ...
matlabArray1, ...
expectedNumChunks, ...
expectedLength, ...
expectedNumElements, ...
expectedArrowType);

name = char.empty(1, 0);
column = arrowTable.column(name);
expectedNumChunks = int32(1);
expectedLength = int64(3);
expectedNumElements = int64(3);
expectedArrowType = arrow.float64();
testCase.verifyChunkedArray(column, ...
matlabArray1, ...
expectedNumChunks, ...
expectedLength, ...
expectedNumElements, ...
expectedArrowType);

% Should match the second column whose name is "B".
name = 'B';
column = arrowTable.column(name);
expectedNumChunks = int32(1);
expectedLength = int64(3);
expectedNumElements = int64(3);
expectedArrowType = arrow.string();
testCase.verifyChunkedArray(column, ...
matlabArray2, ...
expectedNumChunks, ...
expectedLength, ...
expectedNumElements, ...
expectedArrowType);

% Should match the third column whose name is "123".
name = '123';
column = arrowTable.column(name);
expectedNumChunks = int32(1);
expectedLength = int64(3);
expectedNumElements = int64(3);
expectedArrowType = arrow.boolean();
testCase.verifyChunkedArray(column, ...
matlabArray3, ...
expectedNumChunks, ...
expectedLength, ...
expectedNumElements, ...
expectedArrowType);
end

Expand Down Expand Up @@ -680,11 +680,11 @@ function verifyTable(testCase, arrowTable, expectedColumnNames, expectedArrayCla
end
end

function verifyChunkedArray(testCase, chunkedArray, expectedMatlabData, expectedNumChunks, expectedLength, expectedArrowType)
function verifyChunkedArray(testCase, chunkedArray, expectedMatlabData, expectedNumChunks, expectedNumElements, expectedArrowType)
testCase.verifyInstanceOf(chunkedArray, "arrow.array.ChunkedArray");
testCase.verifyEqual(toMATLAB(chunkedArray), expectedMatlabData);
testCase.verifyEqual(chunkedArray.NumChunks, expectedNumChunks)
testCase.verifyEqual(chunkedArray.Length, expectedLength);
testCase.verifyEqual(chunkedArray.NumElements, expectedNumElements);
testCase.verifyEqual(chunkedArray.Type, expectedArrowType);
end

Expand Down

0 comments on commit 35b7287

Please sign in to comment.