MCPcopy Create free account
hub / github.com/apache/arrow-rs / value_to_string

Function value_to_string

arrow-cast/src/cast/string.rs:21–39  ·  view source on GitHub ↗
(
    array: &dyn Array,
    options: &CastOptions,
)

Source from the content-addressed store, hash-verified

19use arrow_buffer::NullBuffer;
20
21pub(crate) fn value_to_string<O: OffsetSizeTrait>(
22 array: &dyn Array,
23 options: &CastOptions,
24) -> Result<ArrayRef, ArrowError> {
25 let mut builder = GenericStringBuilder::<O>::new();
26 let formatter = ArrayFormatter::try_new(array, &options.format_options)?;
27 let nulls = array.nulls();
28 for i in 0..array.len() {
29 match nulls.map(|x| x.is_null(i)).unwrap_or_default() {
30 true => builder.append_null(),
31 false => {
32 formatter.value(i).write(&mut builder)?;
33 // tell the builder the row is finished
34 builder.append_value("");
35 }
36 }
37 }
38 Ok(Arc::new(builder.finish()))
39}
40
41pub(crate) fn value_to_string_view(
42 array: &dyn Array,

Callers

nothing calls this directly

Calls 9

try_newFunction · 0.85
nullsMethod · 0.45
lenMethod · 0.45
is_nullMethod · 0.45
append_nullMethod · 0.45
writeMethod · 0.45
valueMethod · 0.45
append_valueMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected