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


##########
native/spark-expr/src/conversion_funcs/cast.rs:
##########
@@ -707,22 +707,38 @@ pub fn spark_cast(
     data_type: &DataType,
     cast_options: &SparkCastOptions,
 ) -> DataFusionResult<ColumnarValue> {
-    match arg {
-        ColumnarValue::Array(array) => Ok(ColumnarValue::Array(cast_array(
-            array,
-            data_type,
-            cast_options,
-        )?)),
+    // let input_type = match &arg {
+    //     ColumnarValue::Array(array) => array.data_type().clone(),
+    //     ColumnarValue::Scalar(scalar) => scalar.data_type(),
+    // };
+
+    let result = match arg {
+        ColumnarValue::Array(array) => {
+            let result_array = cast_array(array, data_type, cast_options)?;
+            ColumnarValue::Array(result_array)
+        }
         ColumnarValue::Scalar(scalar) => {
             // Note that normally CAST(scalar) should be fold in Spark JVM 
side. However, for
             // some cases e.g., scalar subquery, Spark will not fold it, so we 
need to handle it
             // here.
             let array = scalar.to_array()?;
             let scalar =
                 ScalarValue::try_from_array(&cast_array(array, data_type, 
cast_options)?, 0)?;
-            Ok(ColumnarValue::Scalar(scalar))
+            ColumnarValue::Scalar(scalar)
         }
-    }
+    };
+
+    // let result_type = match &result {
+    //     ColumnarValue::Array(array) => array.data_type().clone(),
+    //     ColumnarValue::Scalar(scalar) => scalar.data_type(),
+    // };
+
+    // println!(
+    //     "spark_cast: {} -> {} (requested: {})",
+    //     input_type, result_type, data_type
+    // );

Review Comment:
   can this be removed now?



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