Skip to content

[common] Fix wrong binary ordering due to signed subtraction#8237

Open
ArnavBalyan wants to merge 1 commit into
apache:masterfrom
ArnavBalyan:arnavb/fix-unsigned-sub
Open

[common] Fix wrong binary ordering due to signed subtraction#8237
ArnavBalyan wants to merge 1 commit into
apache:masterfrom
ArnavBalyan:arnavb/fix-unsigned-sub

Conversation

@ArnavBalyan

Copy link
Copy Markdown
Member

Purpose

  • CompareUtils compares binary values with signed byte subtraction, this can cause range predicates on BINARY and
    VARBINARY to silently return wrong rows.
  • Ensure we use Byte.toUnsignedInt on the comparison to represent the range as 0 - 255 instead of -128 to +127.

Tests

  • UT

@ArnavBalyan

Copy link
Copy Markdown
Member Author

cc @JingsongLi @leaves12138 thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant