edponce commented on a change in pull request #12055:
URL: https://github.com/apache/arrow/pull/12055#discussion_r825252229



##########
File path: python/pyarrow/table.pxi
##########
@@ -209,10 +209,14 @@ cdef class ChunkedArray(_PandasConvertible):
         -------
         value : Scalar (index) or ChunkedArray (slice)
         """
+        cdef shared_ptr[CScalar] c_scalar
+
         if isinstance(key, slice):
             return _normalize_slice(self, key)
 
-        return self.getitem(_normalize_index(key, self.chunked_array.length()))
+        c_scalar = GetResultValue(self.chunked_array.GetScalar(
+            _normalize_index(key, self.chunked_array.length())))
+        return Scalar.wrap(<shared_ptr[CScalar]> c_scalar)

Review comment:
       No need to cast. I refactored `__getitem__()` and `getitem()` methods to 
follow [the convention of other container classes, eg. 
`Array`](https://github.com/apache/arrow/blob/master/python/pyarrow/array.pxi#L1139-L1159).




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