Skip to main content

Grouper

Trait Grouper 

Source
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;
    unsafe fn insert_keys_subset(
        &mut self,
        keys: &HashKeys,
        subset: &[IdxSize],
        group_idxs: Option<&mut Vec<IdxSize>>,
    );
    fn get_keys_in_group_order(&self, schema: &Schema) -> DataFrame;
    unsafe fn probe_partitioned_groupers(
        &self,
        groupers: &[Box<dyn Grouper>],
        keys: &HashKeys,
        partitioner: &HashPartitioner,
        invert: bool,
        probe_matches: &mut Vec<IdxSize>,
    );
    unsafe fn contains_key_partitioned_groupers(
        &self,
        groupers: &[Box<dyn Grouper>],
        keys: &HashKeys,
        partitioner: &HashPartitioner,
        invert: bool,
        contains_key: &mut BitmapBuilder,
    );
    fn as_any(&self) -> &dyn Any;
}
Expand description

A Grouper maps keys to groups, such that duplicate keys map to the same group.

Required Methods§

Source

fn new_empty(&self) -> Box<dyn Grouper>

Creates a new empty Grouper similar to this one.

Source

fn reserve(&mut self, additional: usize)

Reserves space for the given number additional groups.

Source

fn num_groups(&self) -> IdxSize

Returns the number of groups in this Grouper.

Source

unsafe fn insert_keys_subset( &mut self, keys: &HashKeys, subset: &[IdxSize], group_idxs: Option<&mut Vec<IdxSize>>, )

Inserts the given subset of keys into this Grouper. If groups_idxs is passed it is extended such with the group index of keys[subset[i]].

§Safety

The subset indexes must be in-bounds.

Source

fn get_keys_in_group_order(&self, schema: &Schema) -> DataFrame

Returns the keys in this Grouper in group order, that is the key for group i is returned in row i.

Source

unsafe fn probe_partitioned_groupers( &self, groupers: &[Box<dyn Grouper>], keys: &HashKeys, partitioner: &HashPartitioner, invert: bool, probe_matches: &mut Vec<IdxSize>, )

Returns the (indices of the) keys found in the groupers. If invert is true it instead returns the keys not found in the groupers.

§Safety

All groupers must have the same schema.

Source

unsafe fn contains_key_partitioned_groupers( &self, groupers: &[Box<dyn Grouper>], keys: &HashKeys, partitioner: &HashPartitioner, invert: bool, contains_key: &mut BitmapBuilder, )

Returns for each key if it is found in the groupers. If invert is true it returns true if it isn’t found.

§Safety

All groupers must have the same schema.

Source

fn as_any(&self) -> &dyn Any

Implementors§