-
Notifications
You must be signed in to change notification settings - Fork 202
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
Update like statements to reflect sql behaviors #91
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from a few nits, this looks great @danielcweeks. Thanks for fixing this 👍
with pytest.raises(ValueError) as exc_info: | ||
parser.parse(statement) | ||
|
||
assert "LIKE expressions only supports wildcard, '%', at the end of a string" in str(exc_info) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one, this was one of my concerns 👍
@@ -78,6 +78,8 @@ | |||
identifier = Word(alphas, alphanums + "_$").set_results_name("identifier") | |||
column = DelimitedList(identifier, delim=".", combine=False).set_results_name("column") | |||
|
|||
like_regex = r'(?P<valid_wildcard>(?<!\\)%$)|(?P<invalid_wildcard>(?<!\\)%)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My first choice would not be a regex, but it works well 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't want to complicate the parser, so this seemed like the most straightforward path.
Co-authored-by: Fokko Driesprong <[email protected]>
Co-authored-by: Fokko Driesprong <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm late to this but took a pass, and LGTM. thanks @danielcweeks
* Update like statements to reflect sql behaciors * Codestyle * Codestyle * Handle NotStartsWith * Update pyiceberg/expressions/parser.py Co-authored-by: Fokko Driesprong <[email protected]> * Update tests/expressions/test_parser.py Co-authored-by: Fokko Driesprong <[email protected]> --------- Co-authored-by: Fokko Driesprong <[email protected]>
No description provided.