Repository navigation
[format] Check value encoding before reusing Avro string-map bytes - #11334
Open
zhangyue19921010 wants to merge 3 commits into
Open
zhangyue19921010 wants to merge 3 commits into
zhangyue19921010 wants to merge 3 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Decoding an encoded string map turns a null into a zeroed slot, which the required string writer would silently write as an empty string. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Purpose
Fixes #11333.
Fix reading external Avro string maps whose value encoding differs from Paimon's requested nullability or null-first union layout. Also avoid copying an encoded map into a destination with different value nullability, which produces invalid Avro output.
Use the existing schema-aware reader for incompatible layouts and retain raw-byte reuse when the encoded value nullability matches the destination.
Tests
Added a real-file read/rewrite matrix using Avro's generic writer and reader as independent producers and consumers. It covers required values, nullable unions in both orders, nulls, empty maps, following fields and both directions of value-nullability changes. Four of six cases fail on the unchanged base; all six pass with the fix.
Final verification: 85 tests passed, with no skips, using
mvn -pl paimon-format -am -DfailIfNoTests=false -DwildcardSuites=none -Dtest=AvroStringMapReadTest,AvroFileFormatTest,AvroFormatReadWriteTest,AvroBytesStringMapTest,AvroBlockReaderTest,AvroSimpleStatsExtractorLeakTest teston JDK 11. Checkstyle, Spotless and Enforcer passed withoutfast-build; the repository-wide license check passed withmvn -N apache-rat:check.