Struct google_cloud_bigquery::storage::array::PrimitiveRunBuilder
pub struct PrimitiveRunBuilder<R, V>where
R: RunEndIndexType,
V: ArrowPrimitiveType,{ /* private fields */ }Expand description
Builder for RunArray of PrimitiveArray
Example:
let mut builder =
PrimitiveRunBuilder::<Int16Type, UInt32Type>::new();
builder.append_value(1234);
builder.append_value(1234);
builder.append_value(1234);
builder.append_null();
builder.append_value(5678);
builder.append_value(5678);
let array = builder.finish();
assert_eq!(array.run_ends().values(), &[3, 4, 6]);
let av = array.values();
assert!(!av.is_null(0));
assert!(av.is_null(1));
assert!(!av.is_null(2));
// Values are polymorphic and so require a downcast.
let ava: &UInt32Array = av.as_primitive::<UInt32Type>();
assert_eq!(ava, &UInt32Array::from(vec![Some(1234), None, Some(5678)]));Implementations§
§impl<R, V> PrimitiveRunBuilder<R, V>where
R: RunEndIndexType,
V: ArrowPrimitiveType,
impl<R, V> PrimitiveRunBuilder<R, V>where R: RunEndIndexType, V: ArrowPrimitiveType,
pub fn new() -> PrimitiveRunBuilder<R, V>
pub fn new() -> PrimitiveRunBuilder<R, V>
Creates a new PrimitiveRunBuilder
pub fn with_capacity(capacity: usize) -> PrimitiveRunBuilder<R, V>
pub fn with_capacity(capacity: usize) -> PrimitiveRunBuilder<R, V>
Creates a new PrimitiveRunBuilder with the provided capacity
capacity: the expected number of run-end encoded values.
§impl<R, V> PrimitiveRunBuilder<R, V>where
R: RunEndIndexType,
V: ArrowPrimitiveType,
impl<R, V> PrimitiveRunBuilder<R, V>where R: RunEndIndexType, V: ArrowPrimitiveType,
pub fn append_option(
&mut self,
value: Option<<V as ArrowPrimitiveType>::Native>
)
pub fn append_option( &mut self, value: Option<<V as ArrowPrimitiveType>::Native> )
Appends optional value to the logical array encoded by the RunArray.
pub fn append_value(&mut self, value: <V as ArrowPrimitiveType>::Native)
pub fn append_value(&mut self, value: <V as ArrowPrimitiveType>::Native)
Appends value to the logical array encoded by the run-ends array.
pub fn append_null(&mut self)
pub fn append_null(&mut self)
Appends null to the logical array encoded by the run-ends array.
pub fn finish(&mut self) -> RunArray<R>
pub fn finish(&mut self) -> RunArray<R>
Creates the RunArray and resets the builder. Panics if RunArray cannot be built.
pub fn finish_cloned(&self) -> RunArray<R>
pub fn finish_cloned(&self) -> RunArray<R>
Creates the RunArray and without resetting the builder. Panics if RunArray cannot be built.
Trait Implementations§
§impl<R, V> ArrayBuilder for PrimitiveRunBuilder<R, V>where
R: RunEndIndexType,
V: ArrowPrimitiveType,
impl<R, V> ArrayBuilder for PrimitiveRunBuilder<R, V>where R: RunEndIndexType, V: ArrowPrimitiveType,
§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Returns the builder as a mutable Any reference.
§fn into_box_any(
self: Box<PrimitiveRunBuilder<R, V>, Global>
) -> Box<dyn Any, Global>
fn into_box_any( self: Box<PrimitiveRunBuilder<R, V>, Global> ) -> Box<dyn Any, Global>
Returns the boxed builder as a box of Any.
§fn finish_cloned(&self) -> Arc<dyn Array, Global>
fn finish_cloned(&self) -> Arc<dyn Array, Global>
Builds the array without resetting the builder.
§impl<R, V> Debug for PrimitiveRunBuilder<R, V>where
R: Debug + RunEndIndexType,
V: Debug + ArrowPrimitiveType,
<V as ArrowPrimitiveType>::Native: Debug,
impl<R, V> Debug for PrimitiveRunBuilder<R, V>where R: Debug + RunEndIndexType, V: Debug + ArrowPrimitiveType, <V as ArrowPrimitiveType>::Native: Debug,
§impl<R, V> Default for PrimitiveRunBuilder<R, V>where
R: RunEndIndexType,
V: ArrowPrimitiveType,
impl<R, V> Default for PrimitiveRunBuilder<R, V>where R: RunEndIndexType, V: ArrowPrimitiveType,
§fn default() -> PrimitiveRunBuilder<R, V>
fn default() -> PrimitiveRunBuilder<R, V>
Returns the “default value” for a type. Read more
§impl<R, V> Extend<Option<<V as ArrowPrimitiveType>::Native>> for PrimitiveRunBuilder<R, V>where
R: RunEndIndexType,
V: ArrowPrimitiveType,
impl<R, V> Extend<Option<<V as ArrowPrimitiveType>::Native>> for PrimitiveRunBuilder<R, V>where R: RunEndIndexType, V: ArrowPrimitiveType,
§fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = Option<<V as ArrowPrimitiveType>::Native>>,
fn extend<T>(&mut self, iter: T)where T: IntoIterator<Item = Option<<V as ArrowPrimitiveType>::Native>>,
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Auto Trait Implementations§
impl<R, V> RefUnwindSafe for PrimitiveRunBuilder<R, V>where <R as ArrowPrimitiveType>::Native: RefUnwindSafe, <V as ArrowPrimitiveType>::Native: RefUnwindSafe,
impl<R, V> Send for PrimitiveRunBuilder<R, V>
impl<R, V> Sync for PrimitiveRunBuilder<R, V>
impl<R, V> Unpin for PrimitiveRunBuilder<R, V>where <R as ArrowPrimitiveType>::Native: Unpin, <V as ArrowPrimitiveType>::Native: Unpin,
impl<R, V> UnwindSafe for PrimitiveRunBuilder<R, V>where <R as ArrowPrimitiveType>::Native: UnwindSafe, <V as ArrowPrimitiveType>::Native: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request