rok commented on code in PR #50325:
URL: https://github.com/apache/arrow/pull/50325#discussion_r3751488933


##########
python/pyarrow/src/arrow/python/arrow_to_pandas.cc:
##########
@@ -2592,8 +2638,9 @@ Status ConvertChunkedArrayToPandas(const PandasOptions& 
options,
   // Table->DataFrame
   modified_options.allow_zero_copy_blocks = true;
 
-  // In case of an extension array default to the storage type
-  if (arr->type()->id() == Type::EXTENSION) {
+  // In case of an extension array default to the storage type, except for UUID
+  // which has a native Python object conversion.
+  if (arr->type()->id() == Type::EXTENSION && !IsUuidExtension(*arr->type())) {

Review Comment:
   In case we're converting Uuid extension array to numpy 
(Array.to_numpy(zero_copy_only=False)) we probably want bytes not uuid.uuids?
   ```suggestion
     if (arr->type()->id() == Type::EXTENSION &&
         (options.to_numpy || !IsUuidExtension(*arr->type()))) {
   ```



##########
python/pyarrow/tests/test_extension_type.py:
##########
@@ -1432,6 +1400,40 @@ def test_uuid_extension():
     assert isinstance(array[0], pa.UuidScalar)
 
 

Review Comment:
   See previous comment:
   ```suggestion
   @pytest.mark.numpy
   def test_uuid_to_numpy_uses_storage():
       value = uuid4()
       array = pa.array([value], type=pa.uuid())
       assert array.to_numpy(zero_copy_only=False).tolist() == [value.bytes]
   
   
   ```



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