Skip to content

Conversation

@danielcweeks
Copy link
Contributor

No description provided.

Copy link
Contributor

@Fokko Fokko left a 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)
Copy link
Contributor

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 👍

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>(?<!\\)%)'
Copy link
Contributor

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 👍

Copy link
Contributor Author

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.

@Fokko Fokko added this to the PyIceberg 0.5.1 release milestone Oct 21, 2023
danielcweeks and others added 2 commits October 21, 2023 15:30
Co-authored-by: Fokko Driesprong <fokko@apache.org>
Co-authored-by: Fokko Driesprong <fokko@apache.org>
@danielcweeks danielcweeks merged commit b6c1b02 into apache:main Oct 21, 2023
@danielcweeks danielcweeks deleted the fix/sql-parse branch October 21, 2023 22:38
Copy link
Contributor

@amogh-jahagirdar amogh-jahagirdar left a 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

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

3 participants