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

evalengine: More functions! #9673

Merged
merged 9 commits into from
Feb 11, 2022
Merged

evalengine: More functions! #9673

merged 9 commits into from
Feb 11, 2022

Conversation

vmg
Copy link
Collaborator

@vmg vmg commented Feb 11, 2022

Description

Hot off the press! New functionality for the evalengine. This PR implements and tests:

  • WEIGHT_STRING: useful to ensure our collations implementation is actually working (spoiler: it is). This includes some changes to the sqlparser because WEIGHT_STRING has special syntax.
  • the ! operator (which is an alias for NOT)
  • the &, |, ^, <<, >>, ~, and BIT_COUNT bit-wise operators
  • some cleanups to the way we're translating code

Related Issue(s)

Checklist

  • Should this PR be backported?
  • Tests were added or are not required
  • Documentation was added or is not required

Deployment Notes

@vmg vmg added Type: Enhancement Logical improvement (somewhere between a bug and feature) Component: Query Serving release notes none labels Feb 11, 2022
Copy link
Member

@GuptaManan100 GuptaManan100 left a comment

Choose a reason for hiding this comment

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

All the changes look good to me. The shift-reduce conflict in the parser is unavoidable because we have a catch-all statement for functions in the end. Until, we remove it, any function which is a non-reserved keyword will have shift-reduce conflicts.

However, the check_make_parser.sh has to be fixed to expect a conflict

@@ -86,6 +86,8 @@ func TestConvertSimplification(t *testing.T) {
{"coalesce(NULL, 2, NULL, 4)", ok("COALESCE(NULL, INT64(2), NULL, INT64(4))"), ok("INT64(2)")},
{"coalesce(NULL, NULL)", ok("COALESCE(NULL, NULL)"), ok("NULL")},
{"coalesce(NULL)", ok("COALESCE(NULL)"), ok("NULL")},
{"weight_string('foobar')", ok(`WEIGHT_STRING(VARCHAR("foobar"))`), ok(`VARBINARY("\x00F\x00O\x00O\x00B\x00A\x00R")`)},
{"weight_string('foobar' as char(12))", ok(`WEIGHT_STRING(VARCHAR("foobar") AS CHAR(12))`), ok(`VARBINARY("\x00F\x00O\x00O\x00B\x00A\x00R\x00 \x00 \x00 \x00 \x00 \x00 ")`)},
Copy link
Collaborator

@systay systay Feb 11, 2022

Choose a reason for hiding this comment

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

shouldn't we also add the bit operations to this test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The bit operations are integration tested in the major suite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Query Serving Type: Enhancement Logical improvement (somewhere between a bug and feature)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants