pitrou commented on a change in pull request #7868:
URL: https://github.com/apache/arrow/pull/7868#discussion_r465809999



##########
File path: python/pyarrow/table.pxi
##########
@@ -226,24 +226,34 @@ cdef class ChunkedArray(_PandasConvertible):
     def _to_pandas(self, options, **kwargs):
         return _array_like_to_pandas(self, options)
 
-    def __array__(self, dtype=None):
+    def to_numpy(self):
+        """
+        Return a NumPy copy of this array (experimental).
+
+        Returns
+        -------
+        array : numpy.ndarray
+        """
         cdef:
             PyObject* out
             PandasOptions c_options
             object values
 
         if self.type.id == _Type_EXTENSION:
-            return (
-                chunked_array(
-                    [self.chunk(i).storage for i in range(self.num_chunks)]
-                ).__array__(dtype)
-            )
+            storage_array = chunked_array([
+                chunk.storage for chunk in self.iterchunks()
+            ])

Review comment:
       Does this work if there's zero chunk, or do you need to pass the type 
explicitly?




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

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


Reply via email to