From 838f9a746dbfb79ddf7e8bcce31fe8c5ccb4b36a Mon Sep 17 00:00:00 2001 From: Sarah Gilmore Date: Wed, 9 Aug 2023 15:46:07 -0400 Subject: [PATCH 1/8] Add makeValidVariableNames function --- .../+internal/makeValidVariableNames.m | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 matlab/src/matlab/+arrow/+tabular/+internal/makeValidVariableNames.m diff --git a/matlab/src/matlab/+arrow/+tabular/+internal/makeValidVariableNames.m b/matlab/src/matlab/+arrow/+tabular/+internal/makeValidVariableNames.m new file mode 100644 index 000000000000..edf0ac8caaf4 --- /dev/null +++ b/matlab/src/matlab/+arrow/+tabular/+internal/makeValidVariableNames.m @@ -0,0 +1,36 @@ +%MAKEVALIDVARIABLENAMES Makes valid table variable names. + +% Licensed to the Apache Software Foundation (ASF) under one or more +% contributor license agreements. See the NOTICE file distributed with +% this work for additional information regarding copyright ownership. +% The ASF licenses this file to you under the Apache License, Version +% 2.0 (the "License"); you may not use this file except in compliance +% with the License. You may obtain a copy of the License at +% +% http://www.apache.org/licenses/LICENSE-2.0 +% +% Unless required by applicable law or agreed to in writing, software +% distributed under the License is distributed on an "AS IS" BASIS, +% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +% implied. See the License for the specific language governing +% permissions and limitations under the License. +function [varnames, modified] = makeValidVariableNames(varnames) + arguments + varnames(1, :) string + end + + reservedNames = ["Properties" "VariableNames" "RowNames", ":"]; + + [varnames, replacedVars] = replaceEmptyVariableNames(varnames); + [varnames, madeUnique] = matlab.lang.makeUniqueStrings(varnames, reservedNames, 63); + + modified = replacedVars || any(madeUnique); +end + +function [varnames, modified] = replaceEmptyVariableNames(varnames) + emptyIndices = find(varnames == ""); + modified = any(emptyIndices); + if modified + varnames(emptyIndices) = compose("Var%d", emptyIndices); + end +end From 872c60a7412408344f57ab37840e7566d58cd372 Mon Sep 17 00:00:00 2001 From: Kevin Gurney Date: Wed, 9 Aug 2023 15:47:02 -0400 Subject: [PATCH 2/8] Add basic tests for makeValidVariableNames. --- .../arrow/tabular/tMakeValidVariableNames.m | 164 ++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 matlab/test/arrow/tabular/tMakeValidVariableNames.m diff --git a/matlab/test/arrow/tabular/tMakeValidVariableNames.m b/matlab/test/arrow/tabular/tMakeValidVariableNames.m new file mode 100644 index 000000000000..53164cde6d7d --- /dev/null +++ b/matlab/test/arrow/tabular/tMakeValidVariableNames.m @@ -0,0 +1,164 @@ +classdef tMakeValidVariableNames < matlab.unittest.TestCase + + methods(Test) + + function Colon(testCase) + % Verify that ":" becomes ":_1". + import arrow.tabular.internal.* + + original = ":"; + expected = ":_1"; + + actual = makeValidVariableNames(original); + + testCase.verifyEqual(actual, expected); + end + + function RowNames(testCase) + % Verify that "RowNames" becomes "RowNames_1". + import arrow.tabular.internal.* + + original = "RowNames"; + expected = "RowNames_1"; + actual = makeValidVariableNames(original); + testCase.verifyEqual(actual, expected); + end + + function Properties(testCase) + % Verify that "Properties" becomes "Properties_1". + import arrow.tabular.internal.* + + original = "Properties"; + expected = "Properties_1"; + + actual = makeValidVariableNames(original); + + testCase.verifyEqual(actual, expected); + end + + function VariableNames(testCase) + % Verify that "VariableNames" becomes VariableNames_1. + import arrow.tabular.internal.* + + original = "VariableNames"; + expected = "VariableNames_1"; + + actual = makeValidVariableNames(original); + + testCase.verifyEqual(actual, expected); + end + + function ValidVariableNames(testCase) + % Verify that when all of the input strings + % are valid table variable names, that none of them + % are modified. + import arrow.tabular.internal.* + + original = ["A", "B", "C"]; + expected = original; + + actual = makeValidVariableNames(original); + + testCase.verifyEqual(actual, expected); + end + + function ValidVariableNamesUnicode(testCase) + % Verify that when all of the input strings are valid Unicode + % table variable names, that none of them are modified. + import arrow.tabular.internal.* + + smiley = "😀"; + tree = "🌲"; + mango = "🥭"; + + original = [smiley, tree, mango]; + expected = original; + + actual = makeValidVariableNames(original); + + testCase.verifyEqual(actual, expected); + end + + function PropertiesWithConflictingNumericSuffix(testCase) + % Verify that conflicting numeric suffixes (e.g. "Properties" + % and "Properties_1") are resolved as expected. + import arrow.tabular.internal.* + + original = ["Properties", "Properties_1"]; + expected = ["Properties_2", "Properties_1"]; + + actual = makeValidVariableNames(original); + + testCase.verifyEqual(actual, expected); + + original = ["Properties_1", "Properties", "Properties_4"]; + expected = ["Properties_1", "Properties_2", "Properties_4"]; + + actual = makeValidVariableNames(original); + + testCase.verifyEqual(actual, expected); + end + + function RowNamesWithConflictingNumericSuffix(testCase) + % Verify that conflicting numeric suffixes (e.g. "RowNames" + % and "RowNames_1") are resolved as expected. + import arrow.tabular.internal.* + + original = ["RowNames", "RowNames_1"]; + expected = ["RowNames_2", "RowNames_1"]; + + actual = makeValidVariableNames(original); + + testCase.verifyEqual(actual, expected); + + original = ["RowNames_1", "RowNames", "RowNames_4"]; + expected = ["RowNames_1", "RowNames_2", "RowNames_4"]; + + actual = makeValidVariableNames(original); + + testCase.verifyEqual(actual, expected); + end + + function VariableNamesWithConflictingNumericSuffix(testCase) + % Verify that conflicting numeric suffixes (e.g. "VariableNames" + % and "VariableNames_1") are resolved as expected. + import arrow.tabular.internal.* + + original = ["VariableNames", "VariableNames_1"]; + expected = ["VariableNames_2", "VariableNames_1"]; + + actual = makeValidVariableNames(original); + + testCase.verifyEqual(actual, expected); + + original = ["VariableNames_1", "VariableNames", "VariableNames_4"]; + expected = ["VariableNames_1", "VariableNames_2", "VariableNames_4"]; + + actual = makeValidVariableNames(original); + + testCase.verifyEqual(actual, expected); + end + + function ColonWithConflictingSuffix(testCase) + % Verify that conflicting suffixes (e.g. ":" + % and "x_") are resolved as expected. + import arrow.tabular.internal.* + + original = [":", ":_1"]; + expected = [":_2", ":_1"]; + + actual = makeValidVariableNames(original); + + testCase.verifyEqual(actual, expected); + + original = [":_1", ":", ":_4"]; + expected = [":_1", ":_2", ":_4"]; + + actual = makeValidVariableNames(original); + + testCase.verifyEqual(actual, expected); + end + + end + +end \ No newline at end of file From 84e6dc02b1b1b3dd3e6ce9082e4d6d0ffa801ccf Mon Sep 17 00:00:00 2001 From: Kevin Gurney Date: Wed, 9 Aug 2023 15:57:31 -0400 Subject: [PATCH 3/8] Add tests for empty strings. --- .../arrow/tabular/tMakeValidVariableNames.m | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/matlab/test/arrow/tabular/tMakeValidVariableNames.m b/matlab/test/arrow/tabular/tMakeValidVariableNames.m index 53164cde6d7d..bf127a135e10 100644 --- a/matlab/test/arrow/tabular/tMakeValidVariableNames.m +++ b/matlab/test/arrow/tabular/tMakeValidVariableNames.m @@ -159,6 +159,34 @@ function ColonWithConflictingSuffix(testCase) testCase.verifyEqual(actual, expected); end + function EmptyStrings(testCase) + % Verify that empty strings are mapped to Var1, ..., Vari, ..., + % VarN as expected and that conflicting names are resolved as + % expected. + import arrow.tabular.internal.* + + original = ""; + expected = "Var1"; + + actual = makeValidVariableNames(original); + + testCase.verifyEqual(actual, expected); + + original = ["", "Var1", ""]; + expected = ["Var1", "Var1_1", "Var3"]; + + actual = makeValidVariableNames(original); + + testCase.verifyEqual(actual, expected); + + original = ["", "Var1", "Var1_1"]; + expected = ["Var1", "Var1_2", "Var1_1"]; + + actual = makeValidVariableNames(original); + + testCase.verifyEqual(actual, expected); + end + end end \ No newline at end of file From 0b27c238a8bcda3241200cb3ad71222096f1788e Mon Sep 17 00:00:00 2001 From: Sarah Gilmore Date: Wed, 9 Aug 2023 16:10:36 -0400 Subject: [PATCH 4/8] Add makeValidDimensionNames function --- .../+internal/makeValidDimensionNames.m | 28 ++++++ .../arrow/tabular/tMakeValidDimensionNames.m | 90 +++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100644 matlab/src/matlab/+arrow/+tabular/+internal/makeValidDimensionNames.m create mode 100644 matlab/test/arrow/tabular/tMakeValidDimensionNames.m diff --git a/matlab/src/matlab/+arrow/+tabular/+internal/makeValidDimensionNames.m b/matlab/src/matlab/+arrow/+tabular/+internal/makeValidDimensionNames.m new file mode 100644 index 000000000000..88f7b1080621 --- /dev/null +++ b/matlab/src/matlab/+arrow/+tabular/+internal/makeValidDimensionNames.m @@ -0,0 +1,28 @@ +%MAKEVALIDDIMENSIONNAMES Makes valid table dimension names with +% respect to the variable names. + +% Licensed to the Apache Software Foundation (ASF) under one or more +% contributor license agreements. See the NOTICE file distributed with +% this work for additional information regarding copyright ownership. +% The ASF licenses this file to you under the Apache License, Version +% 2.0 (the "License"); you may not use this file except in compliance +% with the License. You may obtain a copy of the License at +% +% http://www.apache.org/licenses/LICENSE-2.0 +% +% Unless required by applicable law or agreed to in writing, software +% distributed under the License is distributed on an "AS IS" BASIS, +% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +% implied. See the License for the specific language governing +% permissions and limitations under the License. +function dimnames = makeValidDimensionNames(varnames) + + dimnames = ["Row" "Variables"]; + + numvars = numel(varnames); + indicesToUniqify = [numvars + 1 numvars + 2]; + + strs = matlab.lang.makeUniqueStrings([varnames dimnames], indicesToUniqify); + dimnames = strs(indicesToUniqify); +end + diff --git a/matlab/test/arrow/tabular/tMakeValidDimensionNames.m b/matlab/test/arrow/tabular/tMakeValidDimensionNames.m new file mode 100644 index 000000000000..296787a63c6b --- /dev/null +++ b/matlab/test/arrow/tabular/tMakeValidDimensionNames.m @@ -0,0 +1,90 @@ +%TMAKEVALIDDIMENSIONNAMES Unit tests for +% arrow.tabular.internal.makeValidDimensionNames. + +% Licensed to the Apache Software Foundation (ASF) under one or more +% contributor license agreements. See the NOTICE file distributed with +% this work for additional information regarding copyright ownership. +% The ASF licenses this file to you under the Apache License, Version +% 2.0 (the "License"); you may not use this file except in compliance +% with the License. You may obtain a copy of the License at +% +% http://www.apache.org/licenses/LICENSE-2.0 +% +% Unless required by applicable law or agreed to in writing, software +% distributed under the License is distributed on an "AS IS" BASIS, +% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +% implied. See the License for the specific language governing +% permissions and limitations under the License. + +classdef tMakeValidDimensionNames < matlab.unittest.TestCase + + methods(TestClassSetup) + % Shared setup for the entire test class + end + + methods(TestMethodSetup) + % Setup for each test + end + + methods(Test) + % Test methods + + function VariableNamedRow(testCase) + % Verify the default dimension name "Row" is replaced with "Row_1" + % if one of the variables is named "Row". + import arrow.tabular.internal.* + + varnames = ["Row" "Var2"]; + dimnames = makeValidDimensionNames(varnames); + testCase.verifyEqual(dimnames, ["Row_1", "Variables"]); + end + + function VariableNamedVariables(testCase) + % Verify the default dimension name "Variables" is replaced with + % "Variables_1" if one of the variables is named "Variables". + import arrow.tabular.internal.* + + varnames = ["Var1" "Variables"]; + dimnames = makeValidDimensionNames(varnames); + testCase.verifyEqual(dimnames, ["Row", "Variables_1"]); + end + + function VariablesWithConflictingNumericSuffix(testCase) + % Verify that conflicting numeric suffixes (e.g. "Variables" + % and "Variables_1") are resolved as expected. + + import arrow.tabular.internal.* + + varnames = ["A" "Variables_1" "Variables"]; + dimnames = makeValidDimensionNames(varnames); + testCase.verifyEqual(dimnames, ["Row", "Variables_2"]); + end + + function RowWithConflictingNumericSuffix(testCase) + % Verify that conflicting numeric suffixes (e.g. "Row" + % and "Row_1") are resolved as expected. + + import arrow.tabular.internal.* + + varnames = ["Row_1" "Row" "Row_3" "Test"]; + dimnames = makeValidDimensionNames(varnames); + testCase.verifyEqual(dimnames, ["Row_2", "Variables"]); + end + + function DefaultDimensionNamesOk(testCase) + % Verify the dimension names are set to the default values + % ("Row" and "Variables") if they are not one of the variable + % names. + + import arrow.tabular.internal.* + + varnames = ["row" "variables"]; + dimnames = makeValidDimensionNames(varnames); + testCase.verifyEqual(dimnames, ["Row", "Variables"]); + + varnames = ["A" "B" "C"]; + dimnames = makeValidDimensionNames(varnames); + testCase.verifyEqual(dimnames, ["Row", "Variables"]); + end + end +end \ No newline at end of file From 8a67fceb1012a81b29f5c7d02a0b5e3f347aef0e Mon Sep 17 00:00:00 2001 From: Sarah Gilmore Date: Wed, 9 Aug 2023 16:10:49 -0400 Subject: [PATCH 5/8] Add license header --- .../arrow/tabular/tMakeValidVariableNames.m | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/matlab/test/arrow/tabular/tMakeValidVariableNames.m b/matlab/test/arrow/tabular/tMakeValidVariableNames.m index bf127a135e10..c212d568a8e4 100644 --- a/matlab/test/arrow/tabular/tMakeValidVariableNames.m +++ b/matlab/test/arrow/tabular/tMakeValidVariableNames.m @@ -1,3 +1,20 @@ +%TMAKEVALIDVARIABLENAMES Unit tests for +% arrow.tabular.internal.makeValidVariableNames. + +% Licensed to the Apache Software Foundation (ASF) under one or more +% contributor license agreements. See the NOTICE file distributed with +% this work for additional information regarding copyright ownership. +% The ASF licenses this file to you under the Apache License, Version +% 2.0 (the "License"); you may not use this file except in compliance +% with the License. You may obtain a copy of the License at +% +% http://www.apache.org/licenses/LICENSE-2.0 +% +% Unless required by applicable law or agreed to in writing, software +% distributed under the License is distributed on an "AS IS" BASIS, +% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +% implied. See the License for the specific language governing +% permissions and limitations under the License. classdef tMakeValidVariableNames < matlab.unittest.TestCase methods(Test) From 99b489e47b3c85ff9442699de063ca92b051772f Mon Sep 17 00:00:00 2001 From: Sarah Gilmore Date: Wed, 9 Aug 2023 16:15:38 -0400 Subject: [PATCH 6/8] Test second output for makeValidVariableNames --- .../arrow/tabular/tMakeValidVariableNames.m | 51 ++++++++++++------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/matlab/test/arrow/tabular/tMakeValidVariableNames.m b/matlab/test/arrow/tabular/tMakeValidVariableNames.m index c212d568a8e4..64bce3b1c8d3 100644 --- a/matlab/test/arrow/tabular/tMakeValidVariableNames.m +++ b/matlab/test/arrow/tabular/tMakeValidVariableNames.m @@ -26,9 +26,10 @@ function Colon(testCase) original = ":"; expected = ":_1"; - actual = makeValidVariableNames(original); + [actual, modified] = makeValidVariableNames(original); testCase.verifyEqual(actual, expected); + testCase.verifyTrue(modified); end function RowNames(testCase) @@ -37,8 +38,9 @@ function RowNames(testCase) original = "RowNames"; expected = "RowNames_1"; - actual = makeValidVariableNames(original); + [actual, modified] = makeValidVariableNames(original); testCase.verifyEqual(actual, expected); + testCase.verifyTrue(modified); end function Properties(testCase) @@ -48,9 +50,10 @@ function Properties(testCase) original = "Properties"; expected = "Properties_1"; - actual = makeValidVariableNames(original); + [actual, modified] = makeValidVariableNames(original); testCase.verifyEqual(actual, expected); + testCase.verifyTrue(modified); end function VariableNames(testCase) @@ -60,9 +63,10 @@ function VariableNames(testCase) original = "VariableNames"; expected = "VariableNames_1"; - actual = makeValidVariableNames(original); + [actual, modified] = makeValidVariableNames(original); testCase.verifyEqual(actual, expected); + testCase.verifyTrue(modified); end function ValidVariableNames(testCase) @@ -74,9 +78,10 @@ function ValidVariableNames(testCase) original = ["A", "B", "C"]; expected = original; - actual = makeValidVariableNames(original); + [actual, modified] = makeValidVariableNames(original); testCase.verifyEqual(actual, expected); + testCase.verifyFalse(modified); end function ValidVariableNamesUnicode(testCase) @@ -91,9 +96,10 @@ function ValidVariableNamesUnicode(testCase) original = [smiley, tree, mango]; expected = original; - actual = makeValidVariableNames(original); + [actual, modified] = makeValidVariableNames(original); testCase.verifyEqual(actual, expected); + testCase.verifyFalse(modified); end function PropertiesWithConflictingNumericSuffix(testCase) @@ -104,16 +110,18 @@ function PropertiesWithConflictingNumericSuffix(testCase) original = ["Properties", "Properties_1"]; expected = ["Properties_2", "Properties_1"]; - actual = makeValidVariableNames(original); + [actual, modified] = makeValidVariableNames(original); testCase.verifyEqual(actual, expected); + testCase.verifyTrue(modified); original = ["Properties_1", "Properties", "Properties_4"]; expected = ["Properties_1", "Properties_2", "Properties_4"]; - actual = makeValidVariableNames(original); + [actual, modified] = makeValidVariableNames(original); testCase.verifyEqual(actual, expected); + testCase.verifyTrue(modified); end function RowNamesWithConflictingNumericSuffix(testCase) @@ -124,16 +132,18 @@ function RowNamesWithConflictingNumericSuffix(testCase) original = ["RowNames", "RowNames_1"]; expected = ["RowNames_2", "RowNames_1"]; - actual = makeValidVariableNames(original); + [actual, modified] = makeValidVariableNames(original); testCase.verifyEqual(actual, expected); + testCase.verifyTrue(modified); original = ["RowNames_1", "RowNames", "RowNames_4"]; expected = ["RowNames_1", "RowNames_2", "RowNames_4"]; - actual = makeValidVariableNames(original); + [actual, modified] = makeValidVariableNames(original); testCase.verifyEqual(actual, expected); + testCase.verifyTrue(modified); end function VariableNamesWithConflictingNumericSuffix(testCase) @@ -144,16 +154,18 @@ function VariableNamesWithConflictingNumericSuffix(testCase) original = ["VariableNames", "VariableNames_1"]; expected = ["VariableNames_2", "VariableNames_1"]; - actual = makeValidVariableNames(original); + [actual, modified] = makeValidVariableNames(original); testCase.verifyEqual(actual, expected); + testCase.verifyTrue(modified); original = ["VariableNames_1", "VariableNames", "VariableNames_4"]; expected = ["VariableNames_1", "VariableNames_2", "VariableNames_4"]; - actual = makeValidVariableNames(original); + [actual, modified] = makeValidVariableNames(original); testCase.verifyEqual(actual, expected); + testCase.verifyTrue(modified); end function ColonWithConflictingSuffix(testCase) @@ -164,16 +176,18 @@ function ColonWithConflictingSuffix(testCase) original = [":", ":_1"]; expected = [":_2", ":_1"]; - actual = makeValidVariableNames(original); + [actual, modified] = makeValidVariableNames(original); testCase.verifyEqual(actual, expected); + testCase.verifyTrue(modified); original = [":_1", ":", ":_4"]; expected = [":_1", ":_2", ":_4"]; - actual = makeValidVariableNames(original); + [actual, modified] = makeValidVariableNames(original); testCase.verifyEqual(actual, expected); + testCase.verifyTrue(modified); end function EmptyStrings(testCase) @@ -185,23 +199,26 @@ function EmptyStrings(testCase) original = ""; expected = "Var1"; - actual = makeValidVariableNames(original); + [actual, modified] = makeValidVariableNames(original); testCase.verifyEqual(actual, expected); + testCase.verifyTrue(modified); original = ["", "Var1", ""]; expected = ["Var1", "Var1_1", "Var3"]; - actual = makeValidVariableNames(original); + [actual, modified] = makeValidVariableNames(original); testCase.verifyEqual(actual, expected); + testCase.verifyTrue(modified); original = ["", "Var1", "Var1_1"]; expected = ["Var1", "Var1_2", "Var1_1"]; - actual = makeValidVariableNames(original); + [actual, modified] = makeValidVariableNames(original); testCase.verifyEqual(actual, expected); + testCase.verifyTrue(modified); end end From afb53275408b96b40afec56ff60e4c4c0d30abbf Mon Sep 17 00:00:00 2001 From: Sarah Gilmore Date: Wed, 9 Aug 2023 16:48:33 -0400 Subject: [PATCH 7/8] Add test for max variable name length --- .../test/arrow/tabular/tMakeValidVariableNames.m | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/matlab/test/arrow/tabular/tMakeValidVariableNames.m b/matlab/test/arrow/tabular/tMakeValidVariableNames.m index 64bce3b1c8d3..239bee4952b2 100644 --- a/matlab/test/arrow/tabular/tMakeValidVariableNames.m +++ b/matlab/test/arrow/tabular/tMakeValidVariableNames.m @@ -221,6 +221,21 @@ function EmptyStrings(testCase) testCase.verifyTrue(modified); end + function VariableNameLengthMax(testCase) + % Verify strings whose character length exceeds 63 + % are truncated to the max variable name length (63). + + import arrow.tabular.internal.* + + original = string(repmat('a', [1 64])); + expected = extractBefore(original, 64); + + [actual, modified] = makeValidVariableNames(original); + + testCase.verifyEqual(actual, expected); + testCase.verifyTrue(modified); + end + end end \ No newline at end of file From c45f1895ca64f2a4a1a815489ca84b00e4f25928 Mon Sep 17 00:00:00 2001 From: Sarah Gilmore Date: Wed, 9 Aug 2023 17:22:33 -0400 Subject: [PATCH 8/8] Address code feedback --- .../+tabular/+internal/makeValidVariableNames.m | 2 +- .../test/arrow/tabular/tMakeValidDimensionNames.m | 13 ++----------- matlab/test/arrow/tabular/tMakeValidVariableNames.m | 1 - 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/matlab/src/matlab/+arrow/+tabular/+internal/makeValidVariableNames.m b/matlab/src/matlab/+arrow/+tabular/+internal/makeValidVariableNames.m index edf0ac8caaf4..b2abdc55aee8 100644 --- a/matlab/src/matlab/+arrow/+tabular/+internal/makeValidVariableNames.m +++ b/matlab/src/matlab/+arrow/+tabular/+internal/makeValidVariableNames.m @@ -19,7 +19,7 @@ varnames(1, :) string end - reservedNames = ["Properties" "VariableNames" "RowNames", ":"]; + reservedNames = ["Properties", "VariableNames", "RowNames", ":"]; [varnames, replacedVars] = replaceEmptyVariableNames(varnames); [varnames, madeUnique] = matlab.lang.makeUniqueStrings(varnames, reservedNames, 63); diff --git a/matlab/test/arrow/tabular/tMakeValidDimensionNames.m b/matlab/test/arrow/tabular/tMakeValidDimensionNames.m index 296787a63c6b..3e80fec91bc8 100644 --- a/matlab/test/arrow/tabular/tMakeValidDimensionNames.m +++ b/matlab/test/arrow/tabular/tMakeValidDimensionNames.m @@ -17,18 +17,9 @@ % permissions and limitations under the License. classdef tMakeValidDimensionNames < matlab.unittest.TestCase - - methods(TestClassSetup) - % Shared setup for the entire test class - end - - methods(TestMethodSetup) - % Setup for each test - end - + methods(Test) - % Test methods - + function VariableNamedRow(testCase) % Verify the default dimension name "Row" is replaced with "Row_1" % if one of the variables is named "Row". diff --git a/matlab/test/arrow/tabular/tMakeValidVariableNames.m b/matlab/test/arrow/tabular/tMakeValidVariableNames.m index 239bee4952b2..53b4ea67fb4b 100644 --- a/matlab/test/arrow/tabular/tMakeValidVariableNames.m +++ b/matlab/test/arrow/tabular/tMakeValidVariableNames.m @@ -224,7 +224,6 @@ function EmptyStrings(testCase) function VariableNameLengthMax(testCase) % Verify strings whose character length exceeds 63 % are truncated to the max variable name length (63). - import arrow.tabular.internal.* original = string(repmat('a', [1 64]));