Struct deltalake::datafusion::physical_plan::aggregates::PhysicalGroupBy
source · pub struct PhysicalGroupBy { /* private fields */ }
Expand description
Represents GROUP BY
clause in the plan (including the more general GROUPING SET)
In the case of a simple GROUP BY a, b
clause, this will contain the expression [a, b]
and a single group [false, false].
In the case of GROUP BY GROUPING SET/CUBE/ROLLUP
the planner will expand the expression
into multiple groups, using null expressions to align each group.
For example, with a group by clause GROUP BY GROUPING SET ((a,b),(a),(b))
the planner should
create a PhysicalGroupBy
like
PhysicalGroupBy {
expr: [(col(a), a), (col(b), b)],
null_expr: [(NULL, a), (NULL, b)],
groups: [
[false, false], // (a,b)
[false, true], // (a) <=> (a, NULL)
[true, false] // (b) <=> (NULL, b)
]
}
Implementations§
source§impl PhysicalGroupBy
impl PhysicalGroupBy
sourcepub fn new(
expr: Vec<(Arc<dyn PhysicalExpr>, String)>,
null_expr: Vec<(Arc<dyn PhysicalExpr>, String)>,
groups: Vec<Vec<bool>>
) -> PhysicalGroupBy
pub fn new( expr: Vec<(Arc<dyn PhysicalExpr>, String)>, null_expr: Vec<(Arc<dyn PhysicalExpr>, String)>, groups: Vec<Vec<bool>> ) -> PhysicalGroupBy
Create a new PhysicalGroupBy
sourcepub fn new_single(expr: Vec<(Arc<dyn PhysicalExpr>, String)>) -> PhysicalGroupBy
pub fn new_single(expr: Vec<(Arc<dyn PhysicalExpr>, String)>) -> PhysicalGroupBy
Create a GROUPING SET with only a single group. This is the “standard”
case when building a plan from an expression such as GROUP BY a,b,c
sourcepub fn contains_null(&self) -> bool
pub fn contains_null(&self) -> bool
Returns true if this GROUP BY contains NULL expressions
sourcepub fn expr(&self) -> &[(Arc<dyn PhysicalExpr>, String)]
pub fn expr(&self) -> &[(Arc<dyn PhysicalExpr>, String)]
Returns the group expressions
sourcepub fn null_expr(&self) -> &[(Arc<dyn PhysicalExpr>, String)]
pub fn null_expr(&self) -> &[(Arc<dyn PhysicalExpr>, String)]
Returns the null expressions
sourcepub fn input_exprs(&self) -> Vec<Arc<dyn PhysicalExpr>>
pub fn input_exprs(&self) -> Vec<Arc<dyn PhysicalExpr>>
Calculate GROUP BY expressions according to input schema.
sourcepub fn output_exprs(&self) -> Vec<Arc<dyn PhysicalExpr>>
pub fn output_exprs(&self) -> Vec<Arc<dyn PhysicalExpr>>
Return grouping expressions as they occur in the output schema.
Trait Implementations§
source§impl Clone for PhysicalGroupBy
impl Clone for PhysicalGroupBy
source§fn clone(&self) -> PhysicalGroupBy
fn clone(&self) -> PhysicalGroupBy
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PhysicalGroupBy
impl Debug for PhysicalGroupBy
source§impl Default for PhysicalGroupBy
impl Default for PhysicalGroupBy
source§fn default() -> PhysicalGroupBy
fn default() -> PhysicalGroupBy
source§impl PartialEq for PhysicalGroupBy
impl PartialEq for PhysicalGroupBy
source§fn eq(&self, other: &PhysicalGroupBy) -> bool
fn eq(&self, other: &PhysicalGroupBy) -> bool
self
and other
values to be equal, and is used
by ==
.Auto Trait Implementations§
impl Freeze for PhysicalGroupBy
impl !RefUnwindSafe for PhysicalGroupBy
impl Send for PhysicalGroupBy
impl Sync for PhysicalGroupBy
impl Unpin for PhysicalGroupBy
impl !UnwindSafe for PhysicalGroupBy
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> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§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>
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