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])
| 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. |
| 257 | pub 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 |
no test coverage detected
searching dependent graphs…