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


##########
datafusion/optimizer/src/simplify_expressions/unwrap_cast.rs:
##########
@@ -177,6 +192,45 @@ 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> {
+    macro_rules! cast_or_else_return_none {

Review Comment:
   > if they treat this behavior as an "optimization" or if it's simply an 
expected behavior to cast the literal to the column's type
   
   It looks like my guess might be correct—they always cast the literal to the 
column's type, regardless of the operator.
   
   ```sql
   D create table t as values (1), (2), (3);
   D select * from t where col0 < '10';
   ┌───────┐
   │ col0  │
   │ int32 │
   ├───────┤
   │     1 │
   │     2 │
   │     3 │
   └───────┘
   ```



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