Skip to content

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
@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