pub struct PrimitiveBuilder<T>where
T: ArrowPrimitiveType,{ /* private fields */ }
Expand description
Builder for PrimitiveArray
Implementations§
Source§impl<T> PrimitiveBuilder<T>where
T: ArrowPrimitiveType,
impl<T> PrimitiveBuilder<T>where
T: ArrowPrimitiveType,
Sourcepub fn new() -> PrimitiveBuilder<T>
pub fn new() -> PrimitiveBuilder<T>
Creates a new primitive array builder
Sourcepub fn with_capacity(capacity: usize) -> PrimitiveBuilder<T>
pub fn with_capacity(capacity: usize) -> PrimitiveBuilder<T>
Creates a new primitive array builder with capacity no of items
Sourcepub fn new_from_buffer(
values_buffer: MutableBuffer,
null_buffer: Option<MutableBuffer>,
) -> PrimitiveBuilder<T>
pub fn new_from_buffer( values_buffer: MutableBuffer, null_buffer: Option<MutableBuffer>, ) -> PrimitiveBuilder<T>
Creates a new primitive array builder from buffers
Sourcepub fn with_data_type(self, data_type: DataType) -> PrimitiveBuilder<T>
pub fn with_data_type(self, data_type: DataType) -> PrimitiveBuilder<T>
By default PrimitiveBuilder
uses ArrowPrimitiveType::DATA_TYPE
as the
data type of the generated array.
This method allows overriding the data type, to allow specifying timezones
for DataType::Timestamp
or precision and scale for DataType::Decimal128
and DataType::Decimal256
§Panics
This method panics if data_type
is not PrimitiveArray::is_compatible
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the capacity of this builder measured in slots of type T
Sourcepub fn append_value(&mut self, v: <T as ArrowPrimitiveType>::Native)
pub fn append_value(&mut self, v: <T as ArrowPrimitiveType>::Native)
Appends a value of type T
into the builder
Sourcepub fn append_value_n(&mut self, v: <T as ArrowPrimitiveType>::Native, n: usize)
pub fn append_value_n(&mut self, v: <T as ArrowPrimitiveType>::Native, n: usize)
Appends a value of type T
into the builder n
times
Sourcepub fn append_null(&mut self)
pub fn append_null(&mut self)
Appends a null slot into the builder
Sourcepub fn append_nulls(&mut self, n: usize)
pub fn append_nulls(&mut self, n: usize)
Appends n
no. of null’s into the builder
Sourcepub fn append_option(&mut self, v: Option<<T as ArrowPrimitiveType>::Native>)
pub fn append_option(&mut self, v: Option<<T as ArrowPrimitiveType>::Native>)
Appends an Option<T>
into the builder
Sourcepub fn append_slice(&mut self, v: &[<T as ArrowPrimitiveType>::Native])
pub fn append_slice(&mut self, v: &[<T as ArrowPrimitiveType>::Native])
Appends a slice of type T
into the builder
Sourcepub fn append_values(
&mut self,
values: &[<T as ArrowPrimitiveType>::Native],
is_valid: &[bool],
)
pub fn append_values( &mut self, values: &[<T as ArrowPrimitiveType>::Native], is_valid: &[bool], )
Appends values from a slice of type T
and a validity boolean slice
§Panics
Panics if values
and is_valid
have different lengths
Sourcepub fn append_array(&mut self, array: &PrimitiveArray<T>)
pub fn append_array(&mut self, array: &PrimitiveArray<T>)
Appends array values and null to this builder as is (this means that underlying null values are copied as is).
§Panics
Panics if array
and self
data types are different
Sourcepub unsafe fn append_trusted_len_iter(
&mut self,
iter: impl IntoIterator<Item = <T as ArrowPrimitiveType>::Native>,
)
pub unsafe fn append_trusted_len_iter( &mut self, iter: impl IntoIterator<Item = <T as ArrowPrimitiveType>::Native>, )
Appends values from a trusted length iterator.
§Safety
This requires the iterator be a trusted length. This could instead require
the iterator implement TrustedLen
once that is stabilized.
Sourcepub fn finish(&mut self) -> PrimitiveArray<T>
pub fn finish(&mut self) -> PrimitiveArray<T>
Builds the PrimitiveArray
and reset this builder.
Sourcepub fn finish_cloned(&self) -> PrimitiveArray<T>
pub fn finish_cloned(&self) -> PrimitiveArray<T>
Builds the PrimitiveArray
without resetting the builder.
Sourcepub fn values_slice(&self) -> &[<T as ArrowPrimitiveType>::Native]
pub fn values_slice(&self) -> &[<T as ArrowPrimitiveType>::Native]
Returns the current values buffer as a slice
Sourcepub fn values_slice_mut(&mut self) -> &mut [<T as ArrowPrimitiveType>::Native]
pub fn values_slice_mut(&mut self) -> &mut [<T as ArrowPrimitiveType>::Native]
Returns the current values buffer as a mutable slice
Sourcepub fn validity_slice(&self) -> Option<&[u8]>
pub fn validity_slice(&self) -> Option<&[u8]>
Returns the current null buffer as a slice
Sourcepub fn validity_slice_mut(&mut self) -> Option<&mut [u8]>
pub fn validity_slice_mut(&mut self) -> Option<&mut [u8]>
Returns the current null buffer as a mutable slice
Sourcepub fn slices_mut(
&mut self,
) -> (&mut [<T as ArrowPrimitiveType>::Native], Option<&mut [u8]>)
pub fn slices_mut( &mut self, ) -> (&mut [<T as ArrowPrimitiveType>::Native], Option<&mut [u8]>)
Returns the current values buffer and null buffer as a slice
Source§impl<P> PrimitiveBuilder<P>where
P: DecimalType,
impl<P> PrimitiveBuilder<P>where
P: DecimalType,
Sourcepub fn with_precision_and_scale(
self,
precision: u8,
scale: i8,
) -> Result<PrimitiveBuilder<P>, ArrowError>
pub fn with_precision_and_scale( self, precision: u8, scale: i8, ) -> Result<PrimitiveBuilder<P>, ArrowError>
Sets the precision and scale
Source§impl<P> PrimitiveBuilder<P>where
P: ArrowTimestampType,
impl<P> PrimitiveBuilder<P>where
P: ArrowTimestampType,
Sourcepub fn with_timezone(self, timezone: impl Into<Arc<str>>) -> PrimitiveBuilder<P>
pub fn with_timezone(self, timezone: impl Into<Arc<str>>) -> PrimitiveBuilder<P>
Sets the timezone
Sourcepub fn with_timezone_opt<S>(self, timezone: Option<S>) -> PrimitiveBuilder<P>
pub fn with_timezone_opt<S>(self, timezone: Option<S>) -> PrimitiveBuilder<P>
Sets an optional timezone
Trait Implementations§
Source§impl<T> ArrayBuilder for PrimitiveBuilder<T>where
T: ArrowPrimitiveType,
impl<T> ArrayBuilder for PrimitiveBuilder<T>where
T: ArrowPrimitiveType,
Source§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.
Source§fn into_box_any(self: Box<PrimitiveBuilder<T>>) -> Box<dyn Any>
fn into_box_any(self: Box<PrimitiveBuilder<T>>) -> Box<dyn Any>
Returns the boxed builder as a box of Any
.
Source§fn finish_cloned(&self) -> Arc<dyn Array>
fn finish_cloned(&self) -> Arc<dyn Array>
Builds the array without resetting the builder.
Source§impl<T> Debug for PrimitiveBuilder<T>
impl<T> Debug for PrimitiveBuilder<T>
Source§impl<T> Default for PrimitiveBuilder<T>where
T: ArrowPrimitiveType,
impl<T> Default for PrimitiveBuilder<T>where
T: ArrowPrimitiveType,
Source§fn default() -> PrimitiveBuilder<T>
fn default() -> PrimitiveBuilder<T>
Source§impl<P> Extend<Option<<P as ArrowPrimitiveType>::Native>> for PrimitiveBuilder<P>where
P: ArrowPrimitiveType,
impl<P> Extend<Option<<P as ArrowPrimitiveType>::Native>> for PrimitiveBuilder<P>where
P: ArrowPrimitiveType,
Source§fn extend<T>(&mut self, iter: T)
fn extend<T>(&mut self, iter: T)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Auto Trait Implementations§
impl<T> Freeze for PrimitiveBuilder<T>
impl<T> RefUnwindSafe for PrimitiveBuilder<T>
impl<T> Send for PrimitiveBuilder<T>
impl<T> Sync for PrimitiveBuilder<T>
impl<T> Unpin for PrimitiveBuilder<T>
impl<T> UnwindSafe for PrimitiveBuilder<T>
Blanket Implementations§
Source§impl<T> AlignerFor<1> for T
impl<T> AlignerFor<1> for T
Source§impl<T> AlignerFor<1024> for T
impl<T> AlignerFor<1024> for T
Source§type Aligner = AlignTo1024<T>
type Aligner = AlignTo1024<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.Source§impl<T> AlignerFor<128> for T
impl<T> AlignerFor<128> for T
Source§type Aligner = AlignTo128<T>
type Aligner = AlignTo128<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.Source§impl<T> AlignerFor<16> for T
impl<T> AlignerFor<16> for T
Source§impl<T> AlignerFor<16384> for T
impl<T> AlignerFor<16384> for T
Source§type Aligner = AlignTo16384<T>
type Aligner = AlignTo16384<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.Source§impl<T> AlignerFor<2> for T
impl<T> AlignerFor<2> for T
Source§impl<T> AlignerFor<2048> for T
impl<T> AlignerFor<2048> for T
Source§type Aligner = AlignTo2048<T>
type Aligner = AlignTo2048<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.Source§impl<T> AlignerFor<256> for T
impl<T> AlignerFor<256> for T
Source§type Aligner = AlignTo256<T>
type Aligner = AlignTo256<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.Source§impl<T> AlignerFor<32> for T
impl<T> AlignerFor<32> for T
Source§impl<T> AlignerFor<32768> for T
impl<T> AlignerFor<32768> for T
Source§type Aligner = AlignTo32768<T>
type Aligner = AlignTo32768<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.Source§impl<T> AlignerFor<4> for T
impl<T> AlignerFor<4> for T
Source§impl<T> AlignerFor<4096> for T
impl<T> AlignerFor<4096> for T
Source§type Aligner = AlignTo4096<T>
type Aligner = AlignTo4096<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.Source§impl<T> AlignerFor<512> for T
impl<T> AlignerFor<512> for T
Source§type Aligner = AlignTo512<T>
type Aligner = AlignTo512<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.Source§impl<T> AlignerFor<64> for T
impl<T> AlignerFor<64> for T
Source§impl<T> AlignerFor<8> for T
impl<T> AlignerFor<8> for T
Source§impl<T> AlignerFor<8192> for T
impl<T> AlignerFor<8192> for T
Source§type Aligner = AlignTo8192<T>
type Aligner = AlignTo8192<T>
AlignTo*
type which aligns Self
to ALIGNMENT
.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
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<S> ROExtAcc for S
impl<S> ROExtAcc for S
Source§fn f_get<F>(&self, offset: FieldOffset<S, F, Aligned>) -> &F
fn f_get<F>(&self, offset: FieldOffset<S, F, Aligned>) -> &F
offset
. Read moreSource§fn f_get_mut<F>(&mut self, offset: FieldOffset<S, F, Aligned>) -> &mut F
fn f_get_mut<F>(&mut self, offset: FieldOffset<S, F, Aligned>) -> &mut F
offset
. Read moreSource§fn f_get_ptr<F, A>(&self, offset: FieldOffset<S, F, A>) -> *const F
fn f_get_ptr<F, A>(&self, offset: FieldOffset<S, F, A>) -> *const F
offset
. Read moreSource§fn f_get_mut_ptr<F, A>(&mut self, offset: FieldOffset<S, F, A>) -> *mut F
fn f_get_mut_ptr<F, A>(&mut self, offset: FieldOffset<S, F, A>) -> *mut F
offset
. Read moreSource§impl<S> ROExtOps<Aligned> for S
impl<S> ROExtOps<Aligned> for S
Source§fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Aligned>, value: F) -> F
fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Aligned>, value: F) -> F
offset
) with value
,
returning the previous value of the field. Read moreSource§fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Aligned>) -> Fwhere
F: Copy,
fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Aligned>) -> Fwhere
F: Copy,
Source§impl<S> ROExtOps<Unaligned> for S
impl<S> ROExtOps<Unaligned> for S
Source§fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, value: F) -> F
fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, value: F) -> F
offset
) with value
,
returning the previous value of the field. Read moreSource§fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Unaligned>) -> Fwhere
F: Copy,
fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Unaligned>) -> Fwhere
F: Copy,
Source§impl<T> SelfOps for Twhere
T: ?Sized,
impl<T> SelfOps for Twhere
T: ?Sized,
Source§fn piped<F, U>(self, f: F) -> U
fn piped<F, U>(self, f: F) -> U
Source§fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
piped
except that the function takes &Self
Useful for functions that take &Self
instead of Self
. Read moreSource§fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
piped
, except that the function takes &mut Self
.
Useful for functions that take &mut Self
instead of Self
.Source§fn mutated<F>(self, f: F) -> Self
fn mutated<F>(self, f: F) -> Self
Source§fn observe<F>(self, f: F) -> Self
fn observe<F>(self, f: F) -> Self
Source§fn as_ref_<T>(&self) -> &T
fn as_ref_<T>(&self) -> &T
AsRef
,
using the turbofish .as_ref_::<_>()
syntax. Read more