jorisvandenbossche commented on code in PR #40818:
URL: https://github.com/apache/arrow/pull/40818#discussion_r1555408483


##########
python/pyarrow/table.pxi:
##########
@@ -1437,6 +1451,21 @@ def chunked_array(arrays, type=None):
 
     if isinstance(arrays, Array):
         arrays = [arrays]
+    elif hasattr(arrays, "__arrow_c_stream__"):
+        if type is not None:
+            requested_type = type.__arrow_c_schema__()
+        else:
+            requested_type = None
+        capsule = arrays.__arrow_c_stream__(requested_type)
+        result = ChunkedArray._import_from_c_capsule(capsule)
+        if type is not None and result.type != type:

Review Comment:
   If `type` is None then `requested_type` is None, so it shouldn't matter 
which of the two I am checking here. But since this if clause is to check for 
whether we still need to cast to `type` (and not `requested_type`, which is a 
capsule not a pyarrow data type), it seems more logical to check for `type is 
not None`. 



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