datafusion_expr::logical_plan::builder

Function add_group_by_exprs_from_dependencies

Source
pub fn add_group_by_exprs_from_dependencies(
    group_expr: Vec<Expr>,
    schema: &DFSchemaRef,
) -> Result<Vec<Expr>>
Expand description

Add additional “synthetic” group by expressions based on functional dependencies.

For example, if we are grouping on [c1], and we know from functional dependencies that column c1 determines c2, this function adds c2 to the group by list.

This allows MySQL style selects like SELECT col FROM t WHERE pk = 5 if col is unique