Count the number of 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])
| 53 | /// Count the number of distinct exprs in a list of group by expressions. If the |
| 54 | /// first element is a `GroupingSet` expression then it must be the only expr. |
| 55 | pub fn grouping_set_expr_count(group_expr: &[Expr]) -> Result<usize> { |
| 56 | if let Some(Expr::GroupingSet(grouping_set)) = group_expr.first() { |
| 57 | if group_expr.len() > 1 { |
| 58 | return plan_err!( |
| 59 | "Invalid group by expressions, GroupingSet must be the only expression" |
| 60 | ); |
| 61 | } |
| 62 | // Groupings sets have an additional integral column for the grouping id |
| 63 | Ok(grouping_set.distinct_expr().len() + 1) |
| 64 | } else { |
| 65 | grouping_set_to_exprlist(group_expr).map(|exprs| exprs.len()) |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | /// Internal helper that generates indices for powerset subsets using bitset iteration. |
| 70 | /// Returns an iterator of index vectors, where each vector contains the indices |
no test coverage detected
searching dependent graphs…