pub type BinaryRunBuilder<K> = GenericByteRunBuilder<K, BinaryType>;
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> {
run_ends_builder: PrimitiveBuilder<K>,
values_builder: GenericByteBuilder<GenericBinaryType<i32>>,
current_value: Vec<u8>,
has_current_value: bool,
current_run_end_index: usize,
prev_run_end_index: usize,
}
Fields§
§run_ends_builder: PrimitiveBuilder<K>
§values_builder: GenericByteBuilder<GenericBinaryType<i32>>
§current_value: Vec<u8>
§has_current_value: bool
§current_run_end_index: usize
§prev_run_end_index: usize