andygrove commented on code in PR #3491:
URL: https://github.com/apache/datafusion-comet/pull/3491#discussion_r2819837674


##########
native/spark-expr/src/conversion_funcs/cast.rs:
##########
@@ -1138,25 +1123,26 @@ fn cast_binary_formatter(value: &[u8]) -> String {
 /// Determines if DataFusion supports the given cast in a way that is
 /// compatible with Spark
 fn is_datafusion_spark_compatible(from_type: &DataType, to_type: &DataType) -> 
bool {
-    if from_type == to_type {
-        return true;
-    }
-    match from_type {
-        DataType::Null => {
-            matches!(to_type, DataType::List(_))
-        }
-        DataType::Boolean => matches!(
-            to_type,
-            DataType::Int8
-                | DataType::Int16
-                | DataType::Int32
-                | DataType::Int64
-                | DataType::Float32
-                | DataType::Float64
-                | DataType::Utf8
-        ),
-        DataType::Int8 | DataType::Int16 | DataType::Int32 | DataType::Int64 
=> {
-            matches!(
+    is_identity_cast(from_type, to_type)
+        || match from_type {
+            DataType::Null => {
+                matches!(to_type, DataType::List(_))
+            }
+            DataType::Boolean => can_cast_from_boolean(to_type),

Review Comment:
   I guess it makes sense to add a function because you are trying to move the 
logic to a separate file. However, I think it is important to keep the naming 
consistent and not change the functionality in this refractor PR. I would 
suggest naming the function something like 
`is_df_cast_from_bool_spark_compatible` to keep the meaning clear.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to