tlm365 commented on code in PR #16087:
URL: https://github.com/apache/datafusion/pull/16087#discussion_r2095013248


##########
datafusion/functions/src/string/ascii.rs:
##########
@@ -103,19 +103,21 @@ impl ScalarUDFImpl for AsciiFunc {
 
 fn calculate_ascii<'a, V>(array: V) -> Result<ArrayRef, ArrowError>
 where
-    V: ArrayAccessor<Item = &'a str>,
+    V: StringArrayType<'a, Item = &'a str>,
 {
-    let iter = ArrayIter::new(array);
-    let result = iter
-        .map(|string| {
-            string.map(|s| {
-                let mut chars = s.chars();
-                chars.next().map_or(0, |v| v as i32)
-            })
-        })
-        .collect::<Int32Array>();
-
-    Ok(Arc::new(result) as ArrayRef)
+    let mut builder = Int32Builder::with_capacity(array.len());

Review Comment:
   @Dandandan Thanks for reviewing,
   
   > even faster is to avoid the builder, by collecting into a `Vec<i32>` and 
clone the incoming bitmap.
   
   Nice, I checked again and that's true



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