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 |
goldmedal
left a comment
There was a problem hiding this comment.
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! |
alamb
left a comment
There was a problem hiding this comment.
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 👍
| } | ||
|
|
||
| fn like(expr: Expr, pattern: &str) -> Expr { | ||
| fn like(expr: Expr, pattern: impl Into<Expr>) -> Expr { |
There was a problem hiding this comment.
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. |
alamb
left a comment
There was a problem hiding this comment.
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. |
|
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