You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/03/12 05:46:22 UTC

[GitHub] [arrow] edponce commented on a change in pull request #12055: ARROW-11989: [C++][Python] Improve ChunkedArray's complexity for the access of elements

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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org