pub struct GroupValuesPrimitive<T: ArrowPrimitiveType> {
data_type: DataType,
map: HashTable<(usize, u64)>,
null_group: Option<usize>,
values: Vec<T::Native>,
random_state: RandomState,
}Expand description
A GroupValues storing a single column of primitive values
This specialization is significantly faster than using the more general
purpose Rows format
Fields§
§data_type: DataTypeThe data type of the output array
map: HashTable<(usize, u64)>Stores the (group_index, hash) based on the hash of its value
We also store hash is for reducing cost of rehashing. Such cost
is obvious in high cardinality group by situation.
More details can see:
https://github.com/apache/datafusion/issues/15961
null_group: Option<usize>The group index of the null value if any
values: Vec<T::Native>The values for each group index
random_state: RandomStateThe random state used to generate hashes
Implementations§
Source§impl<T: ArrowPrimitiveType> GroupValuesPrimitive<T>
impl<T: ArrowPrimitiveType> GroupValuesPrimitive<T>
Trait Implementations§
Source§impl<T: ArrowPrimitiveType> GroupValues for GroupValuesPrimitive<T>where
T::Native: HashValue,
impl<T: ArrowPrimitiveType> GroupValues for GroupValuesPrimitive<T>where
T::Native: HashValue,
Source§fn intern(&mut self, cols: &[ArrayRef], groups: &mut Vec<usize>) -> Result<()>
fn intern(&mut self, cols: &[ArrayRef], groups: &mut Vec<usize>) -> Result<()>
Calculates the group id for each input row of
cols, assigning new
group ids as necessary. Read moreSource§fn size(&self) -> usize
fn size(&self) -> usize
Returns the number of bytes of memory used by this
GroupValuesSource§fn is_empty(&self) -> bool
fn is_empty(&self) -> bool
Returns true if this
GroupValues is emptySource§fn len(&self) -> usize
fn len(&self) -> usize
The number of values (distinct group values) stored in this
GroupValuesSource§fn clear_shrink(&mut self, batch: &RecordBatch)
fn clear_shrink(&mut self, batch: &RecordBatch)
Clear the contents and shrink the capacity to the size of the batch (free up memory usage)
Auto Trait Implementations§
impl<T> Freeze for GroupValuesPrimitive<T>
impl<T> RefUnwindSafe for GroupValuesPrimitive<T>where
<T as ArrowPrimitiveType>::Native: RefUnwindSafe,
impl<T> Send for GroupValuesPrimitive<T>
impl<T> Sync for GroupValuesPrimitive<T>
impl<T> Unpin for GroupValuesPrimitive<T>where
<T as ArrowPrimitiveType>::Native: Unpin,
impl<T> UnwindSafe for GroupValuesPrimitive<T>where
<T 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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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 more