Skip to content
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

feat: implement bytes comparisons #7804

Merged
merged 3 commits into from
Jul 23, 2021
Merged

Conversation

jzaralim
Copy link
Contributor

Description

Comparisons for BYTES - they are compared lexicographically using the ByteByffer.compareTo function.

Testing done

QTT and unit tests.

Reviewer checklist

  • Ensure docs are updated if necessary. (eg. if a user visible feature is being added or changed).
  • Ensure relevant issues are linked (description should include text like "Fixes #")

@jzaralim jzaralim requested a review from a team as a code owner July 16, 2021 19:22
@jzaralim jzaralim requested a review from spena July 16, 2021 21:10
@@ -118,6 +120,12 @@ private static ComparisonNullCheckFunction getNullCheckFunction(
return Optional.of((o1, o2) -> castLeft.cast(o1).compareTo(castRight.cast(o2)));
} else if (leftType == SqlBaseType.STRING) {
return Optional.of((o1, o2) -> o1.toString().compareTo(o2.toString()));
} else if (either(leftType, rightType, SqlBaseType.BYTES)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean you can compare BYTES with other types?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will eventually throw an error if either of them aren't BYTES. Updated to check that condition earlier.

Copy link
Member

@spena spena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jzaralim jzaralim merged commit 02352f2 into confluentinc:master Jul 23, 2021
@jzaralim jzaralim deleted the bytes_compare branch July 23, 2021 02:58
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.

2 participants