-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Expand LIKE simplification: cover NULL
pattern/expression and constant
#13260
Expand LIKE simplification: cover NULL
pattern/expression and constant
#13260
Conversation
c6285bf
to
be26107
Compare
currently depends on #13259 |
seemed easy enough, done. |
88d6df1
to
6c57af7
Compare
I’m happy with my changes being included in this PR :) |
draft - to be rebased after #13259 lands still ready to review |
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.
Just roughly review now. Overall looks to me. I will check the test cases tomorrow.
#13259 has been merged. 👍 |
e4eae46
to
520ad2b
Compare
@goldmedal rebased, thanks! |
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.
Thank you @findepi and @goldmedal
This looks like a great change to me except for the handling of %%
which I am not sure about. Otherwise 👍
@@ -2987,41 +3051,41 @@ mod tests { | |||
}) | |||
} | |||
|
|||
fn like(expr: Expr, pattern: &str) -> Expr { | |||
fn like(expr: Expr, pattern: impl Into<Expr>) -> Expr { |
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 think we could use Expr::like https://docs.rs/datafusion/latest/datafusion/logical_expr/enum.Expr.html#method.like and similar here instead of these functions
This is likely left over from when the Expr API was less expressive
NULL
pattern/expression and constant
since there are already two reviewers on it, I'll gonna skip this PR. However if you need my input, ping me. |
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.
Thank you @findepi and @goldmedal
I had some small testing suggestions but I think we can add that coverage as a follow on PR as well
datafusion/sqllogictest/test_files/string/string_query.slt.part
Outdated
Show resolved
Hide resolved
FYI, when testing LIKE patterns with potential escapes, beware of difference between sqllogictests and CLI when it comes to backslash (like implicit escape) -- #13286 |
datafusion/sqllogictest/test_files/string/string_query.slt.part
Outdated
Show resolved
Hide resolved
Looks like this branch has some conflicts now to resolve but then I think it will be ready to go |
- cover expression known not to be null - cover NULL pattern - cover repeated '%%' in pattern
The conflicts are because #13288 is now merged. Let me rebase. |
e05417a
to
5a03823
Compare
(just rebased) |
Applied comments and fixed handling of implicit escape. |
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 @findepi @adriangb and @goldmedal for this PR and the reviews |
…ant (apache#13260) * Expand LIKE simplification - cover expression known not to be null - cover NULL pattern - cover repeated '%%' in pattern * Simplify `EXPR LIKE 'constant'` to `expr = 'constant'` * Correctness and style fixes * fix typo --------- Co-authored-by: Adrian Garcia Badaracco <[email protected]>
EXPR LIKE 'constant'
toexpr = 'constant'
#13061 to resolve conflicts