merge_grouping_set_physical_expr

Function merge_grouping_set_physical_expr 

Source
fn merge_grouping_set_physical_expr(
    grouping_sets: &[Vec<Expr>],
    input_dfschema: &DFSchema,
    input_schema: &Schema,
    session_state: &SessionState,
) -> Result<PhysicalGroupBy>
Expand description

Expand and align a GROUPING SET expression. (see https://www.postgresql.org/docs/current/queries-table-expressions.html#QUERIES-GROUPING-SETS)

This will take a list of grouping sets and ensure that each group is properly aligned for the physical execution plan. We do this by identifying all unique expression in each group and conforming each group to the same set of expression types and ordering. For example, if we have something like GROUPING SETS ((a,b,c),(a),(b),(b,c)) we would expand this to `GROUPING SETS ((a,b,c),(a,NULL,NULL),(NULL,b,NULL),(NULL,b,c)) (see https://www.postgresql.org/docs/current/queries-table-expressions.html#QUERIES-GROUPING-SETS)