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

Function cast_string_to_boolean

arrow-cast/src/cast/string.rs:394–410  ·  view source on GitHub ↗

Casts string to boolean

(
    array: &StrArray,
    cast_options: &CastOptions,
)

Source from the content-addressed store, hash-verified

392
393/// Casts string to boolean
394fn cast_string_to_boolean<'a, StrArray>(
395 array: &StrArray,
396 cast_options: &CastOptions,
397) -> Result<ArrayRef, ArrowError>
398where
399 StrArray: StringArrayType<'a>,
400{
401 let output_array = array
402 .iter()
403 .map(|value| match value {
404 Some(value) => cast_single_string_to_boolean(value, cast_options),
405 None => Ok(None),
406 })
407 .collect::<Result<BooleanArray, _>>()?;
408
409 Ok(Arc::new(output_array))
410}
411
412#[inline]
413fn cast_single_string_to_boolean(

Callers 2

cast_utf8_to_booleanFunction · 0.85
cast_utf8view_to_booleanFunction · 0.85

Calls 2

iterMethod · 0.45

Tested by

no test coverage detected