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

Function decode_string

arrow-row/src/variable.rs:406–425  ·  view source on GitHub ↗

Decodes a string array from `rows` with the provided `options` # Safety The row must contain valid UTF-8 data

(
    rows: &mut [&[u8]],
    options: SortOptions,
    validate_utf8: bool,
)

Source from the content-addressed store, hash-verified

404///
405/// The row must contain valid UTF-8 data
406pub unsafe fn decode_string<I: OffsetSizeTrait>(
407 rows: &mut [&[u8]],
408 options: SortOptions,
409 validate_utf8: bool,
410) -> GenericStringArray<I> {
411 let decoded = decode_binary::<I>(rows, options);
412
413 if validate_utf8 {
414 return GenericStringArray::from(decoded);
415 }
416
417 let builder = decoded
418 .into_data()
419 .into_builder()
420 .data_type(GenericStringArray::<I>::DATA_TYPE);
421
422 // SAFETY:
423 // Row data must have come from a valid UTF-8 array
424 GenericStringArray::from(unsafe { builder.build_unchecked() })
425}
426
427/// Decodes a string view array from `rows` with the provided `options`
428///

Callers

nothing calls this directly

Calls 4

data_typeMethod · 0.45
into_builderMethod · 0.45
into_dataMethod · 0.45
build_uncheckedMethod · 0.45

Tested by

no test coverage detected