Repository navigation
GH-ISSUE_NUMBER: [Python][Parquet] Fix ambiguous dotted column projection - #53010
Open
Mohit-25-tech wants to merge 1 commit into
Open
Mohit-25-tech wants to merge 1 commit into
Mohit-25-tech wants to merge 1 commit into
Conversation
|
Thanks for opening a pull request! This pull request has been automatically converted to a draft because its title doesn't match Arrow's required format. If this is not a minor PR, could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project. Then could you also rename the pull request title in the following format? or After updating the title, you can mark the pull request as ready for review. See also: |
Mohit-25-tech
marked this pull request as ready for review
October 10, 2026 15:36
Mohit-25-tech
marked this pull request as ready for review
October 10, 2026 15:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes are included in this PR?
Fixes #52997
This PR fixes an inconsistent column-projection behavior in
pyarrow.parquet.ParquetFilewhen a literal top-level column name collides with a nested field path.Previously, requesting
columns=["a.b"]could unexpectedly return both the literal columna.band a struct columnacontaining nested fieldb.The high-level
pq.read_table()API returns only the literal column in this scenario.Root cause
ParquetFile._build_nested_paths()builds projection lookup keys by joining physical path components with".".This makes two distinct paths share the same lookup key:
As a result,
_get_column_indices()can select physical columns belonging to both fields.Changes
ParquetFilemethod documentation to explain the precedence rule.read(),read_row_group(), anditer_batches().Expected behavior
For a file containing a literal field
a.band a structawith childb:Now selects the literal top-level field
a.b.The nested field remains accessible by selecting its parent
a.This intentionally clarifies the precedence of ambiguous dotted names and aligns the result with
pq.read_table()in the reproduced case.Testing
Original bug reproduction
Proposed fix validation
git diff --checkpassed.Limitations: The full repository test suite could not run locally because the checkout does not contain a built
pyarrow.lib. Pre-commit was unavailable. Full checkout and cross-platform validation remain pending in CI.Compatibility considerations
This change intentionally modifies the behavior of ambiguous projections where a dotted top-level column name collides with a nested path.
Existing callers relying on both fields being selected for one ambiguous name may observe a different output schema.
Maintainer feedback on the proposed exact-name precedence is welcome.
AI assistance
OpenAI Codex assisted with investigation, implementation, regression-test development, and code review.
I independently reproduced the original issue in Kaggle, validated the proposed resolution using additional checks, and reviewed the changes and test results.
Related issue
Fixes #ISSUE_NUMBER