kevingurney commented on code in PR #37475:
URL: https://github.com/apache/arrow/pull/37475#discussion_r1310754835
##########
matlab/test/arrow/tabular/tRecordBatch.m:
##########
@@ -223,6 +223,169 @@ function SchemaNoSetter(tc)
"MATLAB:class:SetProhibited");
end
+ function GetColumnByName(testCase)
+ % Verify that columns can be accessed using a field name.
+ recordBatch = arrow.tabular.RecordBatch.fromArrays(...
+ arrow.array([1, 2, 3]), ...
+ arrow.array(["A", "B", "C"]), ...
+ arrow.array([true, false, true]), ...
+ ColumnNames=["A", "B", "C"] ...
+ );
+
+ expected = arrow.array([1, 2, 3]);
+ actual = recordBatch.column("A");
+ testCase.verifyEqual(actual, expected);
+
+ expected = arrow.array(["A", "B", "C"]);
+ actual = recordBatch.column("B");
+ testCase.verifyEqual(actual, expected);
+
+ expected = arrow.array([true, false, true]);
+ actual = recordBatch.column("C");
+ testCase.verifyEqual(actual, expected);
+ end
+
+ function GetColumnByNameWithEmptyString(testCase)
+ % Verify that a column whose Field name is the empty string ("")
+ % can be accessed using the column() method.
+ recordBatch = arrow.tabular.RecordBatch.fromArrays(...
+ arrow.array([1, 2, 3]), ...
+ arrow.array(["A", "B", "C"]), ...
+ arrow.array([true, false, true]), ...
+ ColumnNames=["A", "", "C"] ...
+ );
+
+ expected = arrow.array(["A", "B", "C"]);
+ actual = recordBatch.column("");
+ testCase.verifyEqual(actual, expected)
+ end
+
+ function GetColumnByNameWithWhitespace(testCase)
+ % Verify that a column whose Field name contains only whitespace
Review Comment:
Fixed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]