datafusion_physical_plan::aggregates

Struct 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 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

Source

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

Source

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

Source

pub fn exprs_nullable(&self) -> Vec<bool>

Calculate GROUP BY expressions nullable

Source

pub fn expr(&self) -> &[(Arc<dyn PhysicalExpr>, String)]

Returns the group expressions

Source

pub fn null_expr(&self) -> &[(Arc<dyn PhysicalExpr>, String)]

Returns the null expressions

Source

pub fn groups(&self) -> &[Vec<bool>]

Returns the group null masks

Source

pub fn is_empty(&self) -> bool

Returns true if this PhysicalGroupBy has no group expressions

Source

pub fn is_single(&self) -> bool

Check whether grouping set is single group

Source

pub fn input_exprs(&self) -> Vec<Arc<dyn PhysicalExpr>>

Calculate GROUP BY expressions according to input schema.

Source

pub fn output_exprs(&self) -> Vec<Arc<dyn PhysicalExpr>>

Return grouping expressions as they occur in the output schema.

Source

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

Source§

fn clone(&self) -> PhysicalGroupBy

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PhysicalGroupBy

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PhysicalGroupBy

Source§

fn default() -> PhysicalGroupBy

Returns the “default value” for a type. Read more
Source§

impl PartialEq for PhysicalGroupBy

Source§

fn eq(&self, other: &PhysicalGroupBy) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T