From e913f154801090609f704fb0a7f3c8a264a50249 Mon Sep 17 00:00:00 2001 From: Sarah Gilmore Date: Wed, 20 Sep 2023 14:39:13 -0400 Subject: [PATCH] Update tStructArray based on code feedback --- matlab/test/arrow/array/tStructArray.m | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/matlab/test/arrow/array/tStructArray.m b/matlab/test/arrow/array/tStructArray.m index 53b43b74d47be..639df65befbf5 100644 --- a/matlab/test/arrow/array/tStructArray.m +++ b/matlab/test/arrow/array/tStructArray.m @@ -227,7 +227,9 @@ function toMATLAB(tc) % in the StructArray are set to the type-specific null values. valid = [1 2 5]; array = StructArray.fromArrays(tc.Float64Array, tc.StringArray, FieldNames=["X", "Y"], Valid=valid); - expectedTable([3 4], :) = repmat({NaN string(missing)}, [2 1]); + float64NullValue = tc.Float64Array.NullSubstitutionValue; + stringNullValue = tc.StringArray.NullSubstitutionValue; + expectedTable([3 4], :) = repmat({float64NullValue stringNullValue}, [2 1]); actualTable = toMATLAB(array); tc.verifyEqual(actualTable, expectedTable); end @@ -244,7 +246,9 @@ function table(tc) % in the StructArray are set to the type-specific null values. valid = [1 2 5]; array = StructArray.fromArrays(tc.Float64Array, tc.StringArray, FieldNames=["X", "Y"], Valid=valid); - expectedTable([3 4], :) = repmat({NaN string(missing)}, [2 1]); + float64NullValue = tc.Float64Array.NullSubstitutionValue; + stringNullValue = tc.StringArray.NullSubstitutionValue; + expectedTable([3 4], :) = repmat({float64NullValue stringNullValue}, [2 1]); actualTable = toMATLAB(array); tc.verifyEqual(actualTable, expectedTable); end @@ -263,7 +267,9 @@ function IsEqualFalse(tc) array1 = StructArray.fromArrays(tc.Float64Array, tc.StringArray, FieldNames=["X", "Y"]); array2 = StructArray.fromArrays(tc.StringArray, tc.Float64Array, FieldNames=["X", "Y"]); array3 = StructArray.fromArrays(tc.Float64Array, tc.StringArray, FieldNames=["A", "B"]); + % StructArrays have the same FieldNames but the Fields have different types. tc.verifyFalse(isequal(array1, array2)); + % Fields of the StructArrays have the same types but the StructArrays have different FieldNames. tc.verifyFalse(isequal(array1, array3)); end