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

Method distinct_expr

datafusion/expr/src/expr.rs:1431–1446  ·  view source on GitHub ↗

Return all distinct exprs in the grouping set. For `CUBE` and `ROLLUP` this is just the underlying list of exprs. For `GROUPING SET` we need to deduplicate the exprs in the underlying sets.

(&self)

Source from the content-addressed store, hash-verified

1429 /// is just the underlying list of exprs. For `GROUPING SET` we need to deduplicate
1430 /// the exprs in the underlying sets.
1431 pub fn distinct_expr(&self) -> Vec<&Expr> {
1432 match self {
1433 GroupingSet::Rollup(exprs) | GroupingSet::Cube(exprs) => {
1434 exprs.iter().collect()
1435 }
1436 GroupingSet::GroupingSets(groups) => {
1437 let mut exprs: Vec<&Expr> = vec![];
1438 for exp in groups.iter().flatten() {
1439 if !exprs.contains(&exp) {
1440 exprs.push(exp);
1441 }
1442 }
1443 exprs
1444 }
1445 }
1446 }
1447}
1448
1449/// A Lambda expression with a set of parameters names and a body

Callers 3

grouping_set_expr_countFunction · 0.80
grouping_set_to_exprlistFunction · 0.80
extract_expressionsFunction · 0.80

Calls 5

collectMethod · 0.80
flattenMethod · 0.80
iterMethod · 0.45
containsMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected