wForget commented on code in PR #2425:
URL: https://github.com/apache/datafusion-comet/pull/2425#discussion_r2418521178


##########
native/spark-expr/src/conversion_funcs/cast.rs:
##########
@@ -1239,6 +1241,39 @@ fn cast_struct_to_struct(
     }
 }
 
+fn cast_array_to_string(
+    array: &ListArray,
+    spark_cast_options: &SparkCastOptions,
+) -> DataFusionResult<ArrayRef> {
+    let mut builder = StringBuilder::with_capacity(array.len(), array.len() * 
16);
+    let mut str = String::with_capacity(array.len() * 16);
+    for row_index in 0..array.len() {
+        if array.is_null(row_index) {
+            builder.append_null();
+        } else {
+            str.clear();
+            let value_ref = array.value(row_index);
+            let native_cast_result = cast_array(value_ref, &Utf8, 
spark_cast_options).unwrap();

Review Comment:
   It may be more efficient to call `cast_array` once on `array.values` before 
the for loop.



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