waynexia commented on code in PR #15299:
URL: https://github.com/apache/datafusion/pull/15299#discussion_r2004397798


##########
datafusion/optimizer/src/simplify_expressions/regex.rs:
##########
@@ -43,6 +47,23 @@ pub fn simplify_regex_expr(
     let mode = OperatorMode::new(&op);
 
     if let Expr::Literal(ScalarValue::Utf8(Some(pattern))) = right.as_ref() {
+        // Handle the special case for ".*" pattern
+        if pattern == ANY_CHAR_REGEX_PATTERN {
+            let new_expr = if mode.not {
+                // not empty
+                let empty_lit = Box::new(lit(""));
+                Expr::BinaryExpr(BinaryExpr {
+                    left,
+                    op: Operator::Eq,
+                    right: empty_lit,
+                })
+            } else {
+                // always true

Review Comment:
   Good catch! I added two cases about null in `simplify_expr.slt`, it should 
work as expected now.



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to