-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Python: starts_with and not_starts_with expressions
#6892
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
Conversation
starts_with and not_starts_with expressions
4cebb46 to
0073407
Compare
Fokko
left a comment
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.
Thanks for picking this up @LuigiCerone I've added some suggestions for more test cases, would you be able to port those over from Java? Thanks!
|
|
||
|
|
||
| def test_starts_with() -> None: | ||
| assert StartsWith("x", "data") == parser.parse("x starts_with 'data'") |
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 don't think starts_with is common in SQL. How about:
| assert StartsWith("x", "data") == parser.parse("x starts_with 'data'") | |
| assert StartsWith("x", "data") == parser.parse("x LIKE 'data*'") |
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.
Yes you are right about the fact that starts_with is not common in SQL. I'm just afraid that LIKE is a little misleading because in SQL it's to look for a pattern in the whole string whereas here it would just be to look for "starts with".
e7d394e to
4a73eae
Compare
|
Need to update |
Co-authored-by: Fokko Driesprong <fokko@apache.org>
Co-authored-by: Fokko Driesprong <fokko@apache.org>
45e5131 to
2a7104f
Compare
Co-authored-by: Fokko Driesprong <fokko@apache.org>
Fokko
left a comment
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.
A few minor nits, but apart from that it looks great. Thanks for picking this up @LuigiCerone!
Co-authored-by: Fokko Driesprong <fokko@apache.org>
f1a06de to
5c60a09
Compare
Fokko
left a comment
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.
Thanks @LuigiCerone for fixing this! Much appreciated!
* Add new expressions * Add test for new expressions * Fix tests and test visitors * Add py arrow tests * Fix visitors, fix mypy * Fix problem on ManifestEvalVisitor * Update python/pyiceberg/expressions/visitors.py Co-authored-by: Fokko Driesprong <fokko@apache.org> * Update python/tests/expressions/test_parser.py Co-authored-by: Fokko Driesprong <fokko@apache.org> * Fix test_parser tests and add more test_evaluator tests for new python operators * Fix ManifestEvalVisitor logic, add more tests * Fixes and minors from review * Add MetricsEvaluator starts_with logic and fix tests * Apply suggestions from code review Co-authored-by: Fokko Driesprong <fokko@apache.org> * Apply suggestions from code review Co-authored-by: Fokko Driesprong <fokko@apache.org> * Fix mypy error --------- Co-authored-by: Luigi Cerone <luigi.cerone@facile.it> Co-authored-by: Fokko Driesprong <fokko@apache.org>
Closes #6112