alan910127 commented on code in PR #15110:
URL: https://github.com/apache/datafusion/pull/15110#discussion_r1987355491


##########
datafusion/optimizer/src/simplify_expressions/unwrap_cast.rs:
##########
@@ -177,6 +192,33 @@ pub(super) fn 
is_cast_expr_and_support_unwrap_cast_in_comparison_for_inlist<
     true
 }
 
+fn cast_literal_to_type_with_op(
+    lit_value: &ScalarValue,
+    target_type: &DataType,
+    op: Operator,
+) -> Option<ScalarValue> {
+    dbg!(lit_value, target_type, op);
+    match (op, lit_value) {
+        (
+            Operator::Eq | Operator::NotEq,
+            ScalarValue::Utf8(Some(ref str))
+            | ScalarValue::Utf8View(Some(ref str))
+            | ScalarValue::LargeUtf8(Some(ref str)),
+        ) => match target_type {
+            DataType::Int8 => str.parse::<i8>().ok().map(ScalarValue::from),

Review Comment:
   Also 2 sqllogictest test cases are added (optimized/number not in range)



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