rgbuilds commented on code in PR #27660:
URL: https://github.com/apache/datafusion/pull/27660#discussion_r4691412299


##########
datafusion/optimizer/src/eliminate_filter.rs:
##########
@@ -247,6 +249,13 @@ fn is_safe_to_discard(expr: &Expr) -> bool {
         {
             is_safe_to_discard(&binary.left) && 
is_safe_to_discard(&binary.right)
         }
+        Expr::Like(like)

Review Comment:
   `LIKE` itself can still fail even when both child expressions are safe and 
the escape character is the default.
   
   Arrow compiles wildcard patterns into regular expressions and can return 
`Compiled regex exceeds size limit`. For example, a pattern column containing 
50,000 `_` characters errors when evaluating `s LIKE p`, whereas `s NOT IN 
('x', NULL) AND s LIKE p` is folded here to `EmptyRelation`, suppressing that 
error. 
   
   Could we restrict this allowlist entry to patterns whose evaluation is 
provably infallible, keeping dynamic patterns conservative, and add an 
end-to-end error-preservation test?



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