-
Notifications
You must be signed in to change notification settings - Fork 4.2k
GH-48254: [Python][Parquet] Support extension types in read_schema #48255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -814,3 +814,25 @@ def msg(c): | |
|
|
||
| with pytest.raises(TypeError, match=msg("FileMetaData")): | ||
| pq.FileMetaData() | ||
|
|
||
|
|
||
| def test_read_schema_uuid_extension_type(tmp_path): | ||
| # These are the raw 16-byte payloads for | ||
| # UUID("e460f970-8351-474e-ac7f-a4673e4ba8cb").bytes and | ||
| # UUID("1e741495-eed5-43ea-9bd7-73dc91424baf").bytes. | ||
| data = [ | ||
| b'\xe4`\xf9p\x83QGN\xac\x7f\xa4g>K\xa8\xcb', | ||
| b'\x1et\x14\x95\xee\xd5C\xea\x9b\xd7s\xdc\x91BK\xaf', | ||
|
Kuinox marked this conversation as resolved.
|
||
| None, | ||
| ] | ||
| table = pa.table([pa.array(data, type=pa.uuid())], names=["ext"]) | ||
|
|
||
| file_path = tmp_path / "uuid.parquet" | ||
| file_path_str = str(file_path) | ||
| pq.write_table(table, file_path_str, store_schema=False) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just curious, is
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it was 6 months ago so I'm only guessing now: I can confirm it if you want
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this makes sense. @raulcd are you OK if we keep it as is? |
||
|
|
||
| schema_default = pq.read_schema(file_path_str) | ||
| assert schema_default.field("ext").type == pa.uuid() | ||
|
|
||
| schema_disabled = pq.read_schema(file_path_str, arrow_extensions_enabled=False) | ||
| assert schema_disabled.field("ext").type == pa.binary(16) | ||
Uh oh!
There was an error while loading. Please reload this page.