andygrove commented on code in PR #3245:
URL: https://github.com/apache/arrow-datafusion/pull/3245#discussion_r954313837


##########
datafusion/optimizer/src/pre_cast_lit_in_comparison.rs:
##########
@@ -200,47 +160,110 @@ fn is_comparison_op(op: &Operator) -> bool {
 }
 
 fn is_support_data_type(data_type: &DataType) -> bool {
-    // TODO support decimal with other data type
     matches!(
         data_type,
-        DataType::Int8 | DataType::Int16 | DataType::Int32 | DataType::Int64
+        DataType::Int8
+            | DataType::Int16
+            | DataType::Int32
+            | DataType::Int64
+            | DataType::Decimal128(_, _)
     )
 }
 
-fn can_integer_literal_cast_to_type(
-    integer_lit_value: &ScalarValue,
+fn try_cast_literal_to_type(
+    lit_value: &ScalarValue,
     target_type: &DataType,
-) -> Result<bool> {
-    if integer_lit_value.is_null() {
+) -> Result<(bool, Option<ScalarValue>)> {

Review Comment:
   It looks like this function always returns either `(true, Some(_))` or 
`(false, None)` so maybe it should just return the `Option` without the bool?



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

Reply via email to