Rebuilds an `Expr` as a projection on top of a collection of `Expr`'s. For example, the expression `a + b < 1` would require, as input, the 2 individual columns, `a` and `b`. But, if the base expressions already contain the `a + b` result, then that may be used in lieu of the `a` and `b` columns. This is useful in the context of a query like: SELECT a + b < 1 ... GROUP BY a + b where post-aggr
(
expr: &Expr,
base_exprs: &[Expr],
plan: &LogicalPlan,
)
| 77 | /// individual columns `a` and `b`, but rather it is a projection against the |
| 78 | /// `a + b` found in the GROUP BY. |
| 79 | pub(crate) fn rebase_expr( |
| 80 | expr: &Expr, |
| 81 | base_exprs: &[Expr], |
| 82 | plan: &LogicalPlan, |
| 83 | ) -> Result<Expr> { |
| 84 | expr.clone() |
| 85 | .transform_down(|nested_expr| { |
| 86 | if base_exprs.contains(&nested_expr) { |
| 87 | Ok(Transformed::yes(expr_as_column_expr(&nested_expr, plan)?)) |
| 88 | } else { |
| 89 | Ok(Transformed::no(nested_expr)) |
| 90 | } |
| 91 | }) |
| 92 | .data() |
| 93 | } |
| 94 | |
| 95 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] |
| 96 | pub(crate) enum CheckColumnsMustReferenceAggregatePurpose { |
no test coverage detected
searching dependent graphs…