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

implementing ORD() function #2256

Merged
merged 13 commits into from
Jan 16, 2024
Merged

implementing ORD() function #2256

merged 13 commits into from
Jan 16, 2024

Conversation

jycor
Copy link
Contributor

@jycor jycor commented Jan 12, 2024

This PR adds support for the ORD() function in MySQL, which converts a unicode character into its numerical representation.
In the case of STRINGS, only the leftmost unicode character is evaluated.

Additionally, this PR fixes the bool -> string coversion to match MySQL.

MySQL Docs: https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_ord

Also fixes: dolthub/dolt#7323

Copy link
Contributor

@fulghum fulghum left a comment

Choose a reason for hiding this comment

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

ORD changes look great. Looks like the change to return booleans as 1 or 0 instead of true or false just needs a little more massaging to make tests happy again. I think you're right that we should fix that though. Probably worth checking ahead of time for any Dolt tests that break from that, too.

I think the server engine tests have a transform step that convert true to 1, so you might be able to just take that out to get them working now that you fixed the root of the boolean representation problem.

Copy link
Contributor

@fulghum fulghum left a comment

Choose a reason for hiding this comment

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

Looks good! You may want to do a pre-build/test against Dolt to catch any test changes for the boolean representation change.

@jycor jycor merged commit e7e445f into main Jan 16, 2024
7 checks passed
@jycor jycor deleted the james/ord branch January 16, 2024 23:56
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.

Unexpected results when comparing with empty string
2 participants