Copilot commented on code in PR #50016:
URL: https://github.com/apache/arrow/pull/50016#discussion_r3331789228


##########
python/pyarrow/tests/test_extension_type.py:
##########
@@ -2120,3 +2120,75 @@ def test_json(storage_type, pickle_module):
                 pa.ArrowInvalid,
                 match=f"Invalid storage type for JsonExtensionType: 
{storage_type}"):
             pa.json_(storage_type)
+
+
+class ListExtensionType(pa.ExtensionType):
+    """Extension type with a list field for testing int32 overflow."""
+
+    def __init__(self):
+        super().__init__(
+            pa.struct({"data": pa.list_(pa.uint8())}),
+            "test_list_ext",
+        )

Review Comment:
   This test defines a new extension type with extension name 
`"test_list_ext"`, but the surrounding tests consistently use fully-qualified 
names like `"pyarrow.tests.*"` for extension types in this file. Using a 
qualified name reduces the risk of collisions with other test modules/types and 
keeps naming consistent.



##########
python/pyarrow/array.pxi:
##########
@@ -401,7 +401,15 @@ def array(object obj, type=None, mask=None, size=None, 
from_pandas=None,
             result = _sequence_to_array(obj, mask, size, type, pool, 
c_from_pandas)
 
     if extension_type is not None:
-        result = ExtensionArray.from_storage(extension_type, result)
+        if isinstance(result, ChunkedArray):
+            # Handle ChunkedArray case (e.g., when data overflows int32)
+            chunks = []
+            for chunk in result.chunks:

Review Comment:
   `BaseExtensionType.wrap_array()` already supports wrapping both `Array` and 
`ChunkedArray` storage (see `BaseExtensionType.wrap_array` in 
`python/pyarrow/types.pxi`). Using it here would simplify the code and avoid a 
Python-level per-chunk loop when the storage auto-chunks (e.g., on int32 offset 
overflow).



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