pub struct Groups<'a> { /* private fields */ }Expand description
The groups of a GroupSpec, ordered by key. Cheap to get.
Implementations§
Source§impl Groups<'_>
impl Groups<'_>
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Number of groups: the rows of to_batch. A spec without keys always
has one.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Whether there are no groups: the spec has keys and no row is counted.
Sourcepub fn revision(&self) -> u64
pub fn revision(&self) -> u64
Increases whenever a group changes (and sometimes when a bulk change recounts the
same groups): rebuild a display of to_batch only when it moved.
Sourcepub fn to_batch(&self) -> Result<RecordBatch, DataError>
pub fn to_batch(&self) -> Result<RecordBatch, DataError>
The groups as one record batch, one row per group in key order: the key columns,
then each aggregate. Keys, min and max have the column’s type, except that dictionary
columns come out decoded (as their value type) and floats canonical (0.0 for -0.0,
one NaN). Counts are UInt64, never null. Sums of integers are Decimal128(38, 0),
which holds any sum a table can produce; sums of decimals Decimal128(38, scale),
null if the exact sum needs more than 38 digits; sums of floats Float64. Means are
Float64. Any other aggregate over no values is null. Allocates.
§Errors
DataError::Arrow if Arrow cannot assemble a column (over 2 GiB of strings).