Repository navigation
AVRO-4265: [java] Defer forward default checks - #4048
Open
skyon0522-ai wants to merge 1 commit into
Open
skyon0522-ai wants to merge 1 commit into
skyon0522-ai wants to merge 1 commit into
Conversation
Keep valid enum defaults from being checked against unresolved record placeholders. Preserve eager validation for resolved types and the existing validation opt-out, without traversing types that need no default check. Cover both parse orders, default rejection, and shared schema identities. Assisted-by: OpenAI Codex
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.
What is the purpose of the change
Fix AVRO-4265. Parsing a record before its referenced enum currently rejects a valid enum field default against the unresolved record placeholder.
Reuse the schema-readiness check already used by the IDL reader, and validate defaults after unresolved references have been replaced. Fully resolved types keep eager validation, and the existing validation opt-out is preserved. Skip the readiness walk when default validation is disabled or no default is present.
Verifying this change
This change adds tests for both record/enum parse orders, retained and aggregate schema identities, invalid defaults after resolution, eager validation of known types, the legacy opt-out, unresolved names, and nullable cross-file cycles.
The valid forward enum case failed on the original production code. The invalid enum case also failed prematurely while parsing, rather than at final resolution. Both pass with this change, while the other controls retain their behavior.
On Linux, the selected
TestSchema,TestSchemaParser, andTestSchemaBuildertests passed under all three configurations: 113 cases per configuration, or 339 test-case executions in total, with no failures, errors or skipped cases. Maven 3.9.11 launched on JDK 21; the unchanged project toolchain configuration selected JDK 17.0.20.1 for compilation and tests. Spotless and Checkstyle passed.The root
installlifecycle, run without global test or quality skip flags, also passed across all 27 reactor projects, including the core Invoker builds on JDK 11, 17 and 21. The upstreamtest -Phadoop2command passed all 27 projects using Hadoop 2.10.1. Existing test skips remain; the Hadoop 2 command covers the test phase.The separate existing limitation involving finite object defaults across circular references is outside this fix; nullable cycles are covered.
Documentation