Parquet: tolerate mixed row-group ordinal metadata on read - #10449
Open
zhuqi-lucas wants to merge 1 commit into
Open
Parquet: tolerate mixed row-group ordinal metadata on read#10449zhuqi-lucas wants to merge 1 commit into
zhuqi-lucas wants to merge 1 commit into
Conversation
Restore pre-apache#8715 tolerance for spec-valid parquet files whose row groups disagree on whether the optional RowGroup.ordinal field is populated (commonly produced by Go parquet writers flushing row groups incrementally). Decode no longer errors; instead: - all ordinals present: honored as written - none present: sequential-filled at decode time, unconditionally, so downstream consumers behave identically on fresh vs reused metadata - mixed: metadata left untouched; consumers that require complete ordinals fail deterministically instead of depending on which row groups a query selects RowNumberReader now rejects mixed-ordinal files up front (even when every selected row group carries an ordinal), and the encrypted column-metadata path returns a proper error instead of panicking on a missing ordinal.
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.
Which issue does this PR close?
ordinalmetadata (or add a lenient reader flag) #10381.Rationale for this change
RowGroup.ordinalis optional in the parquet-format Thrift spec with no uniformity requirement, but since #8715 the reader hard-errors on files whose row groups disagree on whether it is populated (Inconsistent ordinal assignment: ...). Such files are produced in the wild (e.g. Go parquet writers flushing row groups incrementally) and were readable before 57.1.This implements the plan agreed on the issue with @alamb, @etseidl and @vustef:
What changes are included in this PR?
thrift/mod.rs: replace the per-row-groupOrdinalAssigner(which errored on the first inconsistency) with a post-decodeensure_row_group_ordinalsimplementing the three cases above.array_reader/row_number.rs:RowNumberReader::try_newrejects mixed-ordinal files up front — even when every selected row group carries an ordinal — so row numbering for a given file either always works or always fails, regardless of row-group pruning (@vustef's determinism concern).thrift/encryption.rs: the encrypted column-metadata path usedrg.ordinal.unwrap()for the AAD; with mixed metadata now reaching this code, return a proper error instead of panicking (@etseidl's encryption concern — files with fully-populated or fully-missing ordinals are unaffected).Are these changes tested?
Inconsistent ordinal assignmenterror.RowNumberReaderunit tests: mixed metadata errors even for an ordinal-only selection; all-missing metadata errors for any selection.parquettest suite passes with--all-features.Are there any user-facing changes?
Files with mixed or absent row-group ordinal metadata are readable again (as before 57.1). Row-number virtual columns keep their strict guarantee: they now fail deterministically per file instead of depending on row-group selection. No API changes.