(
array: &dyn Array,
options: &CastOptions,
)
| 19 | use arrow_buffer::NullBuffer; |
| 20 | |
| 21 | pub(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 | |
| 41 | pub(crate) fn value_to_string_view( |
| 42 | array: &dyn Array, |
nothing calls this directly
no test coverage detected