parker-cassar commented on code in PR #50325:
URL: https://github.com/apache/arrow/pull/50325#discussion_r3541157696


##########
python/pyarrow/tests/parquet/test_data_types.py:
##########
@@ -604,6 +604,27 @@ def test_uuid_extension_type():
         store_schema=False)
 
 
[email protected]
+def test_uuid_roundtrip(tempdir):
+    import uuid
+    u1, u2 = uuid.uuid4(), uuid.uuid4()
+    df = pd.DataFrame({"id": [u1, None, u2]})
+    table = pa.Table.from_pandas(df)
+    assert table.column("id").type == pa.uuid()
+
+    path = tempdir / "uuid_pandas_roundtrip.parquet"
+    pq.write_table(table, path)
+    read_table = pq.read_table(path)
+    assert read_table.column("id").type == pa.uuid()
+
+    result_df = read_table.to_pandas()
+    assert isinstance(result_df.loc[0, "id"], uuid.UUID)
+    assert isinstance(result_df.loc[2, "id"], uuid.UUID)
+    assert result_df.loc[0, "id"] == u1
+    assert result_df.loc[2, "id"] == u2
+    assert pd.isna(result_df.loc[1, "id"])
+
+

Review Comment:
   No, this did not pass with the 2-D return. Applied your approach,  
__from_arrow__ returns 1-D now and the reshape moved to _reconstruct_block. 
test passes locally.
   
   Note: I squashed my 4 iterative commits into one during a rebase (3rd commit 
was just resyncing main). Then amended that squashed commit with a small pep 8 
fix. The changes since your review are your two suggestions. Sorry for the 
noise, will avoid the mid-review force-pushes going forward.



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