Modify UUID when passing it as a bind variable#160
Merged
Mytherin merged 1 commit intoduckdb:mainfrom Mar 17, 2025
Merged
Conversation
1 task
When parsing an UUID from a string literal DuckDB modifies it with flipping the most significant bit in `UUID::FromString` for the following reason: "Flip the first bit to make `order by uuid` same as `order by uuid::varchar`" When an UUID is read from a result set, JDBC driver flips the MSB again to get back the original UUID in Java. This bit-flipping logic was missing when an UUID was passed from Java as a bind variable. The proposed change adds the same logic when passing bind variables. Testing: existing test is improved to cover both string literal and a bind variable. Fixes: duckdb#147
eb8719d to
3bf2452
Compare
Contributor
|
Thanks! |
2 tasks
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.
When parsing an UUID from a string literal DuckDB modifies it with flipping the most significant bit in
UUID::FromStringfor the following reason:"Flip the first bit to make
order by uuidsame asorder by uuid::varchar"When an UUID is read from a result set, JDBC driver flips the MSB again to get back the original UUID in Java.
This bit-flipping logic was missing when an UUID was passed from Java as a bind variable. The proposed change adds the same logic when passing bind variables.
Testing: existing test is improved to cover both string literal and a bind variable.
Fixes: #147