Skip to content

GH-48254: [Python][Parquet] Support extension types in read_schema - #48255

Merged
raulcd merged 1 commit into
apache:mainfrom
Kuinox:schema_uuid_fix
May 25, 2026
Merged

GH-48254: [Python][Parquet] Support extension types in read_schema#48255
raulcd merged 1 commit into
apache:mainfrom
Kuinox:schema_uuid_fix

Conversation

@Kuinox

@KuinoxKuinox commented Nov 25, 2025

Copy link
Copy Markdown
Contributor

Rationale for this change

pq.read_schema drops extension types (UUID comes back as fixed_size_binary[16]), while ParquetFile.schema_arrow and read_table preserve them. Schema inspection via metadata should match table/extension behavior.

What changes are included in this PR?

  • Plumb arrow_extensions_enabled into read_schema and return schema_arrow when enabled so extension types are preserved.
  • Add regression test ensuring UUID extension types are retained by read_schema and downgraded to binary(16) when extensions are disabled.

Are these changes tested?

  • Yes: added unit test test_read_schema_uuid_extension_type

Are there any user-facing changes?

  • Behavior improvement: read_schema now preserves extension types (e.g., UUID) when extensions are enabled; no API break

Notes:

  • I don't know if the fact the column types being returned are now extension<arrow.uuid> instead of fixed_size_binary[16], is considered a breaking change.
  • This PR patch was AI generated, but I personally reviewed it, the scope is small, and it looks fine to me.

@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #48254has been automatically assigned in GitHub to PR creator.

@Kuinox
Kuinoxforce-pushed the schema_uuid_fix branch 2 times, most recently from 2fcb4b7 to 820ae83CompareDecember 17, 2025 17:34

@AlenkaFAlenkaF left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution @Kuinox!
You can see my comments bellow.

Comment threadpython/pyarrow/parquet/core.py
Comment threadpython/pyarrow/parquet/core.py Outdated
Comment threadpython/pyarrow/tests/parquet/test_data_types.py Outdated
@Kuinox
Kuinoxforce-pushed the schema_uuid_fix branch 2 times, most recently from e16f96f to a144bc4CompareFebruary 4, 2026 12:03
@Kuinox

Copy link
Copy Markdown
ContributorAuthor

I had issues running the tests on my machines (it was indicated green), I now have a non windows machine, so i'll try on it.

@AlenkaF

Copy link
Copy Markdown
Member

@github-actions crossbow submit -g python

@github-actions

Copy link
Copy Markdown

Revision: 966df38

Submitted crossbow builds: ursacomputing/crossbow @ actions-e7fd264d23

TaskStatus
example-python-minimal-build-fedora-condaGitHub Actions
example-python-minimal-build-ubuntu-venvGitHub Actions
test-conda-python-3.10GitHub Actions
test-conda-python-3.10-hdfs-2.9.2GitHub Actions
test-conda-python-3.10-hdfs-3.2.1GitHub Actions
test-conda-python-3.10-pandas-1.3.4-numpy-1.21.2GitHub Actions
test-conda-python-3.11GitHub Actions
test-conda-python-3.11-dask-latestGitHub Actions
test-conda-python-3.11-dask-upstream_develGitHub Actions
test-conda-python-3.11-hypothesisGitHub Actions
test-conda-python-3.11-pandas-latest-numpy-latestGitHub Actions
test-conda-python-3.11-spark-masterGitHub Actions
test-conda-python-3.12GitHub Actions
test-conda-python-3.12-cpython-debugGitHub Actions
test-conda-python-3.12-pandas-latest-numpy-1.26GitHub Actions
test-conda-python-3.12-pandas-latest-numpy-latestGitHub Actions
test-conda-python-3.13GitHub Actions
test-conda-python-3.13-pandas-nightly-numpy-nightlyGitHub Actions
test-conda-python-3.13-pandas-upstream_devel-numpy-nightlyGitHub Actions
test-conda-python-3.14GitHub Actions
test-conda-python-emscriptenGitHub Actions
test-cuda-python-ubuntu-22.04-cuda-11.7.1GitHub Actions
test-debian-12-python-3-amd64GitHub Actions
test-debian-12-python-3-i386GitHub Actions
test-fedora-42-python-3GitHub Actions
test-ubuntu-22.04-python-3GitHub Actions
test-ubuntu-22.04-python-313-freethreadingGitHub Actions
test-ubuntu-24.04-python-3GitHub Actions

@Kuinox

Copy link
Copy Markdown
ContributorAuthor

Are the error expected? The build errors doesn't seems related to my change.

@AlenkaF

Copy link
Copy Markdown
Member

Some of them are, but not that many. Could you first try to rebase again please?

@AlenkaF

Copy link
Copy Markdown
Member

@github-actions crossbow submit -g python

@github-actions

Copy link
Copy Markdown

Revision: 808df3d

Submitted crossbow builds: ursacomputing/crossbow @ actions-8aeeb0e39d

TaskStatus
example-python-minimal-build-fedora-condaGitHub Actions
example-python-minimal-build-ubuntu-venvGitHub Actions
test-conda-python-3.10GitHub Actions
test-conda-python-3.10-hdfs-2.9.2GitHub Actions
test-conda-python-3.10-hdfs-3.2.1GitHub Actions
test-conda-python-3.10-pandas-1.3.4-numpy-1.21.2GitHub Actions
test-conda-python-3.11GitHub Actions
test-conda-python-3.11-dask-latestGitHub Actions
test-conda-python-3.11-dask-upstream_develGitHub Actions
test-conda-python-3.11-hypothesisGitHub Actions
test-conda-python-3.11-pandas-latest-numpy-latestGitHub Actions
test-conda-python-3.11-spark-masterGitHub Actions
test-conda-python-3.12GitHub Actions
test-conda-python-3.12-cpython-debugGitHub Actions
test-conda-python-3.12-pandas-latest-numpy-1.26GitHub Actions
test-conda-python-3.12-pandas-latest-numpy-latestGitHub Actions
test-conda-python-3.13GitHub Actions
test-conda-python-3.13-pandas-nightly-numpy-nightlyGitHub Actions
test-conda-python-3.13-pandas-upstream_devel-numpy-nightlyGitHub Actions
test-conda-python-3.14GitHub Actions
test-conda-python-emscriptenGitHub Actions
test-debian-13-python-3-amd64GitHub Actions
test-debian-13-python-3-i386GitHub Actions
test-fedora-42-python-3GitHub Actions
test-ubuntu-22.04-python-3GitHub Actions
test-ubuntu-22.04-python-313-freethreadingGitHub Actions
test-ubuntu-24.04-python-3GitHub Actions

@AlenkaFAlenkaF left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!
The failures that are left are expected.

@raulcd mind giving one extra look before I merge?

@github-actionsgithub-actionsBot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels May 7, 2026

@raulcdraulcd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor nit and a question but approving as it LGTM,
Thanks @Kuinox for the PR

Comment threadpython/pyarrow/tests/parquet/test_metadata.py

file_path = tmp_path / "uuid.parquet"
file_path_str = str(file_path)
pq.write_table(table, file_path_str, store_schema=False)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious, is store_schema=False relevant?

@KuinoxKuinoxMay 8, 2026

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was 6 months ago so I'm only guessing now:
I remember that there was differents behavior depending if arrow loaded it's stored schema or not.
I don't remember if it was needed here, but store_schema=False would allow to be sure that an uuid logical type is detected as is without arrow getting the information from it's own schema.

I can confirm it if you want

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@github-actionsgithub-actionsBot added awaiting merge Awaiting merge and removed awaiting committer review Awaiting committer review labels May 8, 2026
@raulcd

Copy link
Copy Markdown
Member

Thanks @Kuinox for the PR. Sorry it took me a while to come back to it. I plan to merge once CI finishes successfully.

@raulcd
raulcd merged commit cd1811b into apache:mainMay 25, 2026
24 of 26 checks passed
@raulcdraulcd removed the awaiting merge Awaiting merge label May 25, 2026
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit cd1811b.

There was 1 benchmark result with an error:

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 3 possible false positives for unstable benchmarks that are known to sometimes produce them.

Mottl pushed a commit to Mottl/arrow that referenced this pull request May 26, 2026
…ema (apache#48255)
### Rationale for this change
pq.read_schema drops extension types (UUID comes back as fixed_size_binary[16]), while ParquetFile.schema_arrow and read_table preserve them. Schema inspection via metadata should match table/extension behavior.
### What changes are included in this PR?
- Plumb arrow_extensions_enabled into read_schema and return schema_arrow when enabled so extension types are preserved.
- Add regression test ensuring UUID extension types are retained by read_schema and downgraded to binary(16) when extensions are disabled.
### Are these changes tested?
- Yes: added unit test test_read_schema_uuid_extension_type
### Are there any user-facing changes?
- Behavior improvement: read_schema now preserves extension types (e.g., UUID) when extensions are enabled; no API break
Notes: - I don't know if the fact the column types being returned are now extension<arrow.uuid> instead of fixed_size_binary[16], is considered a breaking change. - This PR patch was AI generated, but I personally reviewed it, the scope is small, and it looks fine to me.
* GitHub Issue: apache#48254
Authored-by: Nicolas Vandeginste <n.vandeginste@abc-arbitrage.com>
Signed-off-by: Raúl Cumplido <raulcumplido@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@Kuinox@AlenkaF@raulcd