Type Alias arrow::array::builder::GenericBinaryBuilder
source · pub type GenericBinaryBuilder<O> = GenericByteBuilder<GenericBinaryType<O>>;
Expand description
Array builder for GenericBinaryArray
Values can be appended using GenericByteBuilder::append_value
, and nulls with
GenericByteBuilder::append_null
.
§Example
let mut builder = GenericBinaryBuilder::<i32>::new();
// Write data
builder.append_value("foo");
// Write second value
builder.append_value(&[0,1,2]);
let array = builder.finish();
// binary values
assert_eq!(array.value(0), b"foo");
assert_eq!(array.value(1), b"\x00\x01\x02");
§Example incrementally writing bytes with write_bytes
let mut builder = GenericBinaryBuilder::<i32>::new();
// Write data in multiple `write_bytes` calls
write!(builder, "foo").unwrap();
write!(builder, "bar").unwrap();
// The next call to append_value finishes the current string
// including all previously written strings.
builder.append_value("baz");
// Write second value with a single write call
write!(builder, "v2").unwrap();
// finish the value by calling append_value with an empty string
builder.append_value("");
let array = builder.finish();
assert_eq!(array.value(0), "foobarbaz".as_bytes());
assert_eq!(array.value(1), "v2".as_bytes());
Aliased Type§
struct GenericBinaryBuilder<O> { /* private fields */ }