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 SETS/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 SETS ((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>>,
) -> Self
pub fn new( expr: Vec<(Arc<dyn PhysicalExpr>, String)>, null_expr: Vec<(Arc<dyn PhysicalExpr>, String)>, groups: Vec<Vec<bool>>, ) -> Self
Create a new PhysicalGroupBy
Sourcepub fn new_single(expr: Vec<(Arc<dyn PhysicalExpr>, String)>) -> Self
pub fn new_single(expr: Vec<(Arc<dyn PhysicalExpr>, String)>) -> Self
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 exprs_nullable(&self) -> Vec<bool>
pub fn exprs_nullable(&self) -> Vec<bool>
Calculate GROUP BY expressions nullable
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.
Sourcepub fn as_final(&self) -> PhysicalGroupBy
pub fn as_final(&self) -> PhysicalGroupBy
Returns the PhysicalGroupBy
for a final aggregation if self
is used for a partial
aggregation.
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
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> 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<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