findepi commented on code in PR #13061:
URL: https://github.com/apache/datafusion/pull/13061#discussion_r1828374080


##########
datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:
##########
@@ -1470,19 +1470,25 @@ impl<'a, S: SimplifyInfo> TreeNodeRewriter for 
Simplifier<'a, S> {
             }) => Transformed::yes(simplify_regex_expr(left, op, right)?),
 
             // Rules for Like
-            Expr::Like(Like {
-                expr,
-                pattern,
-                negated,
-                escape_char: _,
-                case_insensitive: _,
-            }) if !is_null(&expr)
-                && matches!(
-                    pattern.as_ref(),
-                    Expr::Literal(ScalarValue::Utf8(Some(pattern_str))) if 
pattern_str == "%"
-                ) =>
-            {
-                Transformed::yes(lit(!negated))
+            Expr::Like(ref like_expr) => {
+                if let Expr::Literal(ScalarValue::Utf8(Some(pattern_str))) =
+                    like_expr.pattern.as_ref()
+                {
+                    if !is_null(&like_expr.expr) && pattern_str == "%" {
+                        Transformed::yes(lit(!like_expr.negated))

Review Comment:
   > I agree this is incorrect but this is the logic that was there before this 
PR.
   
   thanks for confirming and understood it's pre-existing.
   
   Can it be fixed though?
   i personally would prefer that `git annotate` on the file wouldn't point at 
me as the author of something that's known to be incorrect.
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to