-
Notifications
You must be signed in to change notification settings - Fork 1.7k
AVRO-4210: Fix BinaryData.compareBytes to treat bytes as unsigned #3537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
cc: @martin-g @belugabehr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a regression in the BinaryData.compareBytes method introduced in version 1.12.1, where bytes were incorrectly being treated as signed instead of unsigned during comparison.
- Changed
Arrays.comparetoArrays.compareUnsignedto ensure bytes are treated as unsigned values
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lang/java/avro/src/main/java/org/apache/avro/io/BinaryData.java
Outdated
Show resolved
Hide resolved
|
Let's add some tests! |
Sure, added |
This is a regression fix introudeced in 1.12.1 added unit test
|
I see that in the regression PR there are also usages of the method I noticed this issue since I use the |
|
@martin-g I added a second commit that re-uses It's probably important to merge and release this quickly before adoption of |
This returns the comparision to be unsigned like it was in 1.12.0 This reverts commit 005ee80.
|
Hi @belugabehr, any chance you can have a look at this? @martin-g If @belugabehr isn't available can we move forward with merging. The change shouldn't be risky since it's simply reverting very recent changes. |
|
I'd prefer someone from the Java team to approve it first. |
|
Hello, this looks like the right thing to do -- as a regression, it would be great to have a JIRA associated with it! I can create the JIRA, but if you'd like credit as reporter/fixer, let me know your JIRA id (and/or create one at https://selfserve.apache.org/jira-account.html) |
RyanSkraba
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've verified that this restores the behaviour of compareBytes from 1.12.0 and LGTM.
…ache#3537) * Fixed BinaryData.compareBytes to treat bytes as unsigned This is a regression fix introudeced in 1.12.1 added unit test * Re-use the DirectBytes.compareBytes method to ensure consistency This returns the comparision to be unsigned like it was in 1.12.0 This reverts commit 005ee80.
|
Cherry-picked to branch-1.12. |
|
Hello team,
My sincere apologies for all the swirl on this. I've also been away on
holiday recently - just getting caught up.
It looks like the issue has been resolved, but I'll try to find time this
week to ensure all loose ends are resolved.
Again, very sorry for the oversight on this. I was too trusting of the unit
tests and should have more carefully considered this change. Do note that
it is indeed worthwhile to pursue this, just need to use the unsigned
version of the API.
…On Sun, Nov 23, 2025, 9:48 AM Ryan Skraba ***@***.***> wrote:
*RyanSkraba* left a comment (apache/avro#3537)
<#3537 (comment)>
Hello, this looks like the right thing to do -- as a regression, it would
be great to have a JIRA associated with it! I can create the JIRA, but if
you'd like credit as reporter/fixer, let me know your JIRA id (and/or
create one at https://selfserve.apache.org/jira-account.html)
—
Reply to this email directly, view it on GitHub
<#3537 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC766E27NDS3ZTGKBDY5MGD36HCMDAVCNFSM6AAAAACKKV4G5WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTKNRYGAZTEOBQGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
I think the system is working well 😄 You made an improvement, somebody noticed a difference in behaviour and corrected it -- I'm grateful to both of you ❤️ and everybody wins! |
This is a regression fix introduced in 1.12.1
What is the purpose of the change
Fix a regression in BinaryData.compareBytes introduced here: https://github.com/apache/avro/pull/3126/files
Verifying this change
This change is a trivial rework / code cleanup without any test coverage.
Documentation