Type Alias datafusion::common::arrow::array::BinaryRunBuilder

source ·
pub type BinaryRunBuilder<K> = GenericByteRunBuilder<K, GenericBinaryType<i32>>;
Expand description

Builder for RunArray of BinaryArray

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


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

// The builder builds the dictionary value by value
builder.append_value(b"abc");
builder.append_null();
builder.extend([Some(b"def"), Some(b"def"), Some(b"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: &BinaryArray = av.as_binary();

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

Aliased Type§

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