Repository navigation
MINOR: Read Avro maps with omitted values - #3986
Open
vera-rubin wants to merge 1 commit into
Open
vera-rubin wants to merge 1 commit into
vera-rubin wants to merge 1 commit into
Conversation
Fokko
self-requested a review
November 25, 2026 15:13
Fokko
approved these changes
Nov 25, 2026
Fokko
left a comment
Contributor
There was a problem hiding this comment.
Thanks @vera-rubin, clean fix for the omitted map values. LGTM! 🙌
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.
Rationale for this change
The Parquet MAP rules allow the
valuefield of the repeatedkey_valuegroup to be omitted, but parquet-avro cannot read such a file.AvroReadSupportderives the Avro schema withAvroSchemaConverter, which requires exactly two fields inkey_valueand throws:for this schema:
What changes are included in this PR?
AvroSchemaConverteraccepts akey_valuegroup with only the key field and converts it to an Avro map whose values arenull.AvroRecordConverterandAvroIndexedRecordConverterdo not create a value converter when there is no value field, so each key is read with anullvalue.Maps with a value field are converted as before.
Are these changes tested?
Yes.
TestReadWrite.testMapWithoutValuewrites a required and an optional map without a value field (withExampleParquetWriter), including an empty map and, for the optional map, a null map, and reads them back with the Avro reader for every converter and configuration indata(). It checks the derived value schema (null) and the record values. It fails without the fix (Invalid map type, 13 of 13 parameter sets) and passes with it.mvn -pl parquet-avro testpasses (431 tests, 2 skipped as before) andmvn -pl parquet-avro spotless:checkis clean.Are there any user-facing changes?
Files whose maps have no value field can now be read with parquet-avro; each key maps to
null.