Repository navigation
AVRO-4360: [C++] Fix binary floating-point byte order - #4043
Merged
Fokko merged 1 commit intoOct 14, 2026
Merged
Conversation
Use the little-endian IEEE 754 wire format required by Avro when encoding and decoding floats and doubles on big-endian hosts. Add independent wire-byte regressions for signed zero, finite limits, infinities and NaN payloads across fragmented streams. Co-authored-by: Codex <codex@openai.com>
manuzhang
force-pushed
the
fix/cpp-float-double-endian-regression
branch
from
October 13, 2026 04:48
ec170ca to
1687f59
Compare
manuzhang
marked this pull request as ready for review
October 13, 2026 04:48
Member
|
Could you help review this? @Fokko @thiru-mg @iemejia @RyanSkraba |
Fokko
approved these changes
Oct 14, 2026
Fokko
left a comment
Contributor
There was a problem hiding this comment.
Looks good to me! Do we know if this is the case as well for other types? For example, Decimal?
Member
Author
|
As for decimal, it's the application handling the endian and Avro C++ just preserves bytes. No other types as I've checked. |
Contributor
|
@manuzhang Got it, thanks for checking. Moving this forward 👍 |
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
Avro C++ copies native memory bytes when encoding and decoding float/double values. On big-endian hosts such as s390x, encoding float
1.0produces3f 80 00 00instead of the required00 00 80 3f, and decoding valid little-endian Avro bytes returns the wrong value.Normalize the four binary floating-point methods to little-endian byte order while preserving raw IEEE 754 bits.
Fixes AVRO-4360.
Verifying this change
Added independent golden-byte checks for float and double encoding and decoding, covering signed zero, finite and subnormal limits, infinities, and quiet NaN payloads with stream chunk sizes of 1, 3, and 16 bytes.
Local validation on the exact published source:
CodecTestssuite passes on macOS and Linux ARM64: 852 test cases and 103,659 assertions on each.The s390x result is emulated, rather than a physical s390x run.
Documentation