Skip to content

AddFiles: tighten file schemas - #39975

Open
claudevdm wants to merge 1 commit into
apache:masterfrom
claudevdm:prepass-fileschemas-tigthen
Open

AddFiles: tighten file schemas#39975
claudevdm wants to merge 1 commit into
apache:masterfrom
claudevdm:prepass-fileschemas-tigthen

Conversation

@claudevdm

Copy link
Copy Markdown
Collaborator

AddFiles: tighten file schemas with footer null counts, folded per dclared schema

Parquet writers commonly declare every column optional whatever the data holds. Taken at face value, a file with no nulls in a column the table has as required would ask the pre-pass to relax that column for no reason. Tightening uses the footer's null counts to drop such requests.

The evidence travels beside the schema, not inside it. ReadFooterSchema emits (canonical declared-schema JSON, proven-null-free paths) and CollectDistinctSchemas folds the paths per distinct schema by intersection: a column stays proven only when every file proved it, equivalently a relaxation is requested when any file needs it. The commit side will rebuild the group's most conservative member with FileSchemas.markRequired before classifying, which produces the same table schema as tightening each file individually would. union adds new columns as optional whatever the file declares.

Tightening only affects columns the table already has as required: the union adds new columns as optional whatever the file declares.

Please add a meaningful description for your change here


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

…clared schema

Parquet writers commonly declare every column optional whatever the data
holds. Taken at face value, a file with no nulls in a column the table
has as required would ask the pre-pass to relax that column for no
reason. Tightening uses the footer's null counts to drop such requests.

The evidence travels beside the schema, not inside it. ReadFooterSchema
emits (canonical declared-schema JSON, proven-null-free paths) and
CollectDistinctSchemas folds the paths per distinct schema by
intersection: a column stays proven only when every file proved it,
equivalently a relaxation is requested when any file needs it. The
commit side will rebuild the group's most conservative member with
FileSchemas.markRequired before classifying, which produces the same
table schema as tightening each file individually would.
union adds new columns as optional whatever the file declares.

Tightening only affects columns the table already has as required: the
union adds new columns as optional whatever the file declares.
@claudevdm
claudevdm marked this pull request as ready for review September 2, 2026 17:49
@claudevdm
claudevdm requested a review from ahmedabu98 September 2, 2026 17:49
Sign up for free to 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.

1 participant