MCPcopy Create free account
hub / github.com/apache/datafusion / grouping_set_to_exprlist

Function grouping_set_to_exprlist

datafusion/expr/src/utils.rs:257–272  ·  view source on GitHub ↗

Find all distinct exprs in a list of group by expressions. If the first element is a `GroupingSet` expression then it must be the only expr.

(group_expr: &[Expr])

Source from the content-addressed store, hash-verified

255/// Find all distinct exprs in a list of group by expressions. If the
256/// first element is a `GroupingSet` expression then it must be the only expr.
257pub fn grouping_set_to_exprlist(group_expr: &[Expr]) -> Result<Vec<&Expr>> {
258 if let Some(Expr::GroupingSet(grouping_set)) = group_expr.first() {
259 if group_expr.len() > 1 {
260 return plan_err!(
261 "Invalid group by expressions, GroupingSet must be the only expression"
262 );
263 }
264 Ok(grouping_set.distinct_expr())
265 } else {
266 Ok(group_expr
267 .iter()
268 .collect::<IndexSet<_>>()
269 .into_iter()
270 .collect())
271 }
272}
273
274/// Recursively walk an expression tree, collecting the unique set of columns
275/// referenced in the expression

Callers 6

grouping_set_expr_countFunction · 0.85
try_newMethod · 0.85
output_expressionsMethod · 0.85
find_agg_exprFunction · 0.85
aggregate_output_exprsFunction · 0.85

Calls 6

distinct_exprMethod · 0.80
collectMethod · 0.80
firstMethod · 0.45
lenMethod · 0.45
into_iterMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…