Omega359 commented on code in PR #6719:
URL: https://github.com/apache/arrow-rs/pull/6719#discussion_r1860632919


##########
arrow-cast/src/cast/string.rs:
##########
@@ -38,6 +38,22 @@ pub(crate) fn value_to_string<O: OffsetSizeTrait>(
     Ok(Arc::new(builder.finish()))
 }
 
+pub(crate) fn value_to_string_view(
+    array: &dyn Array,
+    options: &CastOptions,
+) -> Result<ArrayRef, ArrowError> {
+    let mut builder = StringViewBuilder::with_capacity(array.len());
+    let formatter = ArrayFormatter::try_new(array, &options.format_options)?;
+    let nulls = array.nulls();
+    for i in 0..array.len() {
+        match nulls.map(|x| x.is_null(i)).unwrap_or_default() {
+            true => builder.append_null(),
+            false => formatter.value(i).write(&mut builder)?,
+        }
+    }
+    Ok(Arc::new(builder.finish()))
+}

Review Comment:
   This will work nicely (well, once it compiles) and would unblock downstream 
issues. 👍🏻



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

Reply via email to