Add SkipAdditionalFields codec option#300
Closed
fcote wants to merge 1 commit intolinkedin:masterfrom
Closed
Conversation
Introduces a new CodecOption.SkipAdditionalFields that allows decoding
textual Avro data with additional fields not defined in the schema.
When enabled, unknown fields are skipped instead of causing errors.
This is useful for schema evolution scenarios where newer data formats
may include fields that older schemas don't define. The option defaults
to false to maintain backward compatibility.
Changes:
- Add SkipAdditionalFields field to CodecOption
- Update genericMapTextDecoder to skip unknown fields when enabled
- Add advanceToNextValue helper to skip JSON values
- Thread option through record and union decoders
passuied
approved these changes
Jan 1, 2026
Contributor
|
@rockwotj could someone else review this PR? It is very useful IMHO |
rockwotj
reviewed
Jan 2, 2026
Collaborator
rockwotj
left a comment
There was a problem hiding this comment.
there is a bug around escaped quotes
| // Primarily used to handle edge cases where some Avro implementations allow string representations of null. | ||
| EnableStringNull bool | ||
|
|
||
| // SkipAdditionalFields controls handling of additional fields during decoding. |
Collaborator
There was a problem hiding this comment.
This needs to mention it is for the textual format only.
|
|
||
| var ( | ||
| valueBoundaries = map[byte]byte{ | ||
| '"': '"', |
Collaborator
There was a problem hiding this comment.
this doesn’t account for escaped quotes.
Collaborator
There was a problem hiding this comment.
and maybe not for nested object/arrays? It just stops at the first thing it sees
Collaborator
|
I believe this is obsolete via #303 |
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.
Introduces a new
CodecOption.SkipAdditionalFieldsthat allows decoding textual Avro data with additional fields not defined in the schema. When enabled, unknown fields are skipped instead of causing errors.This is useful for schema evolution scenarios where newer data formats may include fields that older schemas don't define. The option defaults to
falseto maintain backward compatibility.Changes:
- Add
SkipAdditionalFieldsfield toCodecOption- Update
genericMapTextDecoderto skip unknown fields when enabled- Add
advanceToNextValuehelper to skip JSON valuesRelated to #294