sgilmore10 commented on code in PR #37475:
URL: https://github.com/apache/arrow/pull/37475#discussion_r1310727723


##########
matlab/src/matlab/+arrow/+tabular/RecordBatch.m:
##########
@@ -54,13 +54,17 @@
         function arrowArray = column(obj, idx)
             import arrow.internal.validate.*
 
-            idx = index.numeric(idx, "int32");
-            % TODO: Consider vectorizing column() in the future to support
-            % extracting multiple columns at once.
-            validateattributes(idx, "int32", "scalar");
-
-            args = struct(Index=idx);
-            [proxyID, typeID] = obj.Proxy.getColumnByIndex(args);              
  
+            idx = index.numericOrString(idx, "int32");
+
+            if isnumeric(idx)
+                validateattributes(idx, "int32", "scalar");

Review Comment:
   You can remove this `validateattributes` call if you include an `arguments` 
block:
   
   ```matlab
   function arrowArray = column(obj, idx)
       arguments
            obj
            idx(1, 1)
       end
       ...
   end
   ```
   That way you don't need to re-validate the type of `idx`



-- 
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]

Reply via email to