coderfender commented on code in PR #3948:
URL: https://github.com/apache/datafusion-comet/pull/3948#discussion_r3084692296


##########
native/spark-expr/src/conversion_funcs/numeric.rs:
##########
@@ -67,11 +67,15 @@ pub(crate) fn 
is_df_cast_from_decimal_spark_compatible(to_type: &DataType) -> bo
             | DataType::Int16
             | DataType::Int32
             | DataType::Int64
-            | DataType::Float32
-            | DataType::Float64
+            | DataType::Float32 // DataFusion divides i128 by 10^scale in f64, 
then narrows to
+            | DataType::Float64 // f32 if needed; empirically matches Spark's 
BigDecimal.doubleValue
+                                // / floatValue for all tested values
             | DataType::Decimal128(_, _)
             | DataType::Decimal256(_, _)
             | DataType::Utf8 // note that there can be formatting differences
+                             // Note: Boolean is intentionally absent. 
Decimal-to-boolean uses a dedicated
+                             // spark_cast_decimal_to_boolean function (in 
cast.rs) that checks the raw i128

Review Comment:
   Thank you for adding this useful comment



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