pub trait Grouper:
Any
+ Send
+ Sync {
// Required methods
fn new_empty(&self) -> Box<dyn Grouper>;
fn reserve(&mut self, additional: usize);
fn num_groups(&self) -> IdxSize;
fn insert_keys(&mut self, keys: &DataFrame, group_idxs: &mut Vec<IdxSize>);
fn combine(&mut self, other: &dyn Grouper, group_idxs: &mut Vec<IdxSize>);
unsafe fn gather_combine(
&mut self,
other: &dyn Grouper,
subset: &[IdxSize],
group_idxs: &mut Vec<IdxSize>,
);
fn gen_partition_idxs(
&self,
partitioner: &HashPartitioner,
partition_idxs: &mut [Vec<IdxSize>],
sketches: &mut [CardinalitySketch],
);
fn get_keys_in_group_order(&self) -> DataFrame;
fn as_any(&self) -> &dyn Any;
// Provided methods
fn store_ooc(&self, _path: &Path) { ... }
fn load_ooc(&mut self, _path: &Path) { ... }
}
Expand description
A Grouper maps keys to groups, such that duplicate keys map to the same group.
Required Methods§
Sourcefn reserve(&mut self, additional: usize)
fn reserve(&mut self, additional: usize)
Reserves space for the given number additional of groups.
Sourcefn num_groups(&self) -> IdxSize
fn num_groups(&self) -> IdxSize
Returns the number of groups in this Grouper.
Sourcefn insert_keys(&mut self, keys: &DataFrame, group_idxs: &mut Vec<IdxSize>)
fn insert_keys(&mut self, keys: &DataFrame, group_idxs: &mut Vec<IdxSize>)
Inserts the given keys into this Grouper, mutating groups_idxs such that group_idxs[i] is the group index of keys[..][i].
Sourcefn combine(&mut self, other: &dyn Grouper, group_idxs: &mut Vec<IdxSize>)
fn combine(&mut self, other: &dyn Grouper, group_idxs: &mut Vec<IdxSize>)
Adds the given Grouper into this one, mutating groups_idxs such that the ith group of other now has group index group_idxs[i] in self.
Sourceunsafe fn gather_combine(
&mut self,
other: &dyn Grouper,
subset: &[IdxSize],
group_idxs: &mut Vec<IdxSize>,
)
unsafe fn gather_combine( &mut self, other: &dyn Grouper, subset: &[IdxSize], group_idxs: &mut Vec<IdxSize>, )
Adds the given Grouper into this one, mutating groups_idxs such that the group subset[i] of other now has group index group_idxs[i] in self.
§Safety
For all i, subset[i] < other.len().
Sourcefn gen_partition_idxs(
&self,
partitioner: &HashPartitioner,
partition_idxs: &mut [Vec<IdxSize>],
sketches: &mut [CardinalitySketch],
)
fn gen_partition_idxs( &self, partitioner: &HashPartitioner, partition_idxs: &mut [Vec<IdxSize>], sketches: &mut [CardinalitySketch], )
Generate partition indices.
After this function partitions_idxs[i] will contain the indices for partition i, and sketches[i] will contain a cardinality sketch for partition i.
Sourcefn get_keys_in_group_order(&self) -> DataFrame
fn get_keys_in_group_order(&self) -> DataFrame
Returns the keys in this Grouper in group order, that is the key for group i is returned in row i.