Type Alias arrow::array::StringRunBuilder

source ·
pub type StringRunBuilder<K> = GenericByteRunBuilder<K, GenericStringType<i32>>;
Expand description

Builder for RunArray of StringArray

// Create a run-end encoded array with run-end indexes data type as `i16`.
// The encoded values are Strings.

let mut builder = StringRunBuilder::<Int16Type>::new();

// The builder builds the dictionary value by value
builder.append_value("abc");
builder.append_null();
builder.extend([Some("def"), Some("def"), Some("abc")]);
let array = builder.finish();

assert_eq!(array.run_ends().values(), &[1, 2, 4, 5]);

// Values are polymorphic and so require a downcast.
let av = array.values();
let ava: &StringArray = av.as_string::<i32>();

assert_eq!(ava.value(0), "abc");
assert!(av.is_null(1));
assert_eq!(ava.value(2), "def");
assert_eq!(ava.value(3), "abc");

Aliased Type§

struct StringRunBuilder<K> { /* private fields */ }