#[non_exhaustive]pub struct Aggregate {
pub input: Arc<LogicalPlan>,
pub group_expr: Vec<Expr>,
pub aggr_expr: Vec<Expr>,
pub schema: DFSchemaRef,
}
Expand description
Aggregates its input based on a set of grouping and aggregate expressions (e.g. SUM).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.input: Arc<LogicalPlan>
The incoming logical plan
group_expr: Vec<Expr>
Grouping expressions
aggr_expr: Vec<Expr>
Aggregate expressions
schema: DFSchemaRef
The schema description of the aggregate output
Implementations§
Source§impl Aggregate
impl Aggregate
Sourcepub const INTERNAL_GROUPING_ID: &'static str = "__grouping_id"
pub const INTERNAL_GROUPING_ID: &'static str = "__grouping_id"
Internal column used when the aggregation is a grouping set.
This column contains a bitmask where each bit represents a grouping expression. The least significant bit corresponds to the rightmost grouping expression. A bit value of 0 indicates that the corresponding column is included in the grouping set, while a value of 1 means it is excluded.
For example, for the grouping expressions CUBE(a, b), the grouping ID
column will have the following values:
0b00: Both a
and b
are included
0b01: b
is excluded
0b10: a
is excluded
0b11: Both a
and b
are excluded
This internal column is necessary because excluded columns are replaced
with NULL
values. To handle these cases correctly, we must distinguish
between an actual NULL
value in a column and a column being excluded from the set.
Sourcepub fn try_new(
input: Arc<LogicalPlan>,
group_expr: Vec<Expr>,
aggr_expr: Vec<Expr>,
) -> Result<Self>
pub fn try_new( input: Arc<LogicalPlan>, group_expr: Vec<Expr>, aggr_expr: Vec<Expr>, ) -> Result<Self>
Create a new aggregate operator.
Sourcepub fn try_new_with_schema(
input: Arc<LogicalPlan>,
group_expr: Vec<Expr>,
aggr_expr: Vec<Expr>,
schema: DFSchemaRef,
) -> Result<Self>
pub fn try_new_with_schema( input: Arc<LogicalPlan>, group_expr: Vec<Expr>, aggr_expr: Vec<Expr>, schema: DFSchemaRef, ) -> Result<Self>
Create a new aggregate operator using the provided schema to avoid the overhead of building the schema again when the schema is already known.
This method should only be called when you are absolutely sure that the schema being provided is correct for the aggregate. If in doubt, call try_new instead.
Sourcepub fn group_expr_len(&self) -> Result<usize>
pub fn group_expr_len(&self) -> Result<usize>
Get the length of the group by expression in the output schema This is not simply group by expression length. Expression may be GroupingSet, etc. In these case we need to get inner expression lengths.
Sourcepub fn grouping_id_type(group_exprs: usize) -> DataType
pub fn grouping_id_type(group_exprs: usize) -> DataType
Returns the data type of the grouping id. The grouping ID value is a bitmask where each set bit indicates that the corresponding grouping expression is null
Trait Implementations§
Source§impl PartialOrd for Aggregate
impl PartialOrd for Aggregate
impl Eq for Aggregate
impl StructuralPartialEq for Aggregate
Auto Trait Implementations§
impl Freeze for Aggregate
impl !RefUnwindSafe for Aggregate
impl Send for Aggregate
impl Sync for Aggregate
impl Unpin for Aggregate
impl !UnwindSafe for Aggregate
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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 more