adriangb commented on code in PR #17521:
URL: https://github.com/apache/datafusion/pull/17521#discussion_r2341155447


##########
datafusion/optimizer/src/simplify_expressions/simplify_predicates.rs:
##########
@@ -204,7 +204,13 @@ fn find_most_restrictive_predicate(
 
             if let Some(scalar) = scalar_value {
                 if let Some(current_best) = best_value {
-                    let comparison = scalar.try_cmp(current_best)?;
+                    // Only compare if the scalar values have compatible types
+                    // If they don't have compatible types, we can't determine 
which is more restrictive
+                    let Ok(comparison) = scalar.try_cmp(current_best) else {
+                        // Can't compare - types are incompatible, so we can't 
simplify

Review Comment:
   If this is wrong, can we add another test that fails with this change?



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