Add negative int32 test coverage for Avro wire format and type widening#602
Merged
leiykpt merged 1 commit intolinkedin:masterfrom Mar 27, 2026
Merged
Add negative int32 test coverage for Avro wire format and type widening#602leiykpt merged 1 commit intolinkedin:masterfrom
leiykpt merged 1 commit intolinkedin:masterfrom
Conversation
…rectly handled through Avro serialization and schema evolution paths.
Collaborator
|
nit but |
li-ukumar
approved these changes
Mar 27, 2026
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.
Summary
This PR adds explicit test coverage proving that negative int32 values are correctly handled at the Avro serialization layer — both binary and JSON wire formats — and that int-to-long type widening preserves sign.
Negative int32 values and very large positive values share overlapping bit representations in two's complement. These tests build confidence that the serialization, deserialization, and schema evolution paths behave correctly for the full signed int32 range.
What's Changed
Added 3 tests to
AvroWireFormatCompatibilityTest.java, each exercising three negative values (-1,-100,Integer.MIN_VALUE):testNegativeInt32BinaryRoundtriptestNegativeInt32JsonRoundtriptestNegativeInt32TypeWideningToLongunion[null, int]schema, read withunion[null, long]schema, verify sign preservedTotal: 9 new test cases (3 tests x 3 values)
These tests run across all supported Avro versions (1.4 through 1.11) via the existing multi-version test harness. No new schemas or dependencies — tests reuse existing
RecordWithNumericFields.avscandWidenIntToLongInUnionField_{writer,reader}.avsc.Test Plan
AvroWireFormatCompatibilityTest.javaremain green