Update like statements to reflect sql behaviors#91
Merged
danielcweeks merged 6 commits intoapache:mainfrom Oct 21, 2023
Merged
Conversation
Fokko
approved these changes
Oct 21, 2023
Contributor
Fokko
left a comment
There was a problem hiding this comment.
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) |
Contributor
There was a problem hiding this comment.
Nice one, this was one of my concerns 👍
| 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>(?<!\\)%)' |
Contributor
There was a problem hiding this comment.
My first choice would not be a regex, but it works well 👍
Contributor
Author
There was a problem hiding this comment.
I didn't want to complicate the parser, so this seemed like the most straightforward path.
Co-authored-by: Fokko Driesprong <fokko@apache.org>
Co-authored-by: Fokko Driesprong <fokko@apache.org>
Contributor
amogh-jahagirdar
left a comment
There was a problem hiding this comment.
I'm late to this but took a pass, and LGTM. thanks @danielcweeks
Fokko
added a commit
that referenced
this pull request
Oct 24, 2023
* Update like statements to reflect sql behaciors * Codestyle * Codestyle * Handle NotStartsWith * Update pyiceberg/expressions/parser.py Co-authored-by: Fokko Driesprong <fokko@apache.org> * Update tests/expressions/test_parser.py Co-authored-by: Fokko Driesprong <fokko@apache.org> --------- Co-authored-by: Fokko Driesprong <fokko@apache.org>
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.
No description provided.