Make a best-effort attempt at resolving all columns in the expression tree
(expr: &Expr, plan: &LogicalPlan)
| 43 | |
| 44 | /// Make a best-effort attempt at resolving all columns in the expression tree |
| 45 | pub(crate) fn resolve_columns(expr: &Expr, plan: &LogicalPlan) -> Result<Expr> { |
| 46 | expr.clone() |
| 47 | .transform_up(|nested_expr| { |
| 48 | match nested_expr { |
| 49 | Expr::Column(col) => { |
| 50 | let (qualifier, field) = |
| 51 | plan.schema().qualified_field_from_column(&col)?; |
| 52 | Ok(Transformed::yes(Expr::Column(Column::from(( |
| 53 | qualifier, field, |
| 54 | ))))) |
| 55 | } |
| 56 | _ => { |
| 57 | // keep recursing |
| 58 | Ok(Transformed::no(nested_expr)) |
| 59 | } |
| 60 | } |
| 61 | }) |
| 62 | .data() |
| 63 | } |
| 64 | |
| 65 | /// Rebuilds an `Expr` as a projection on top of a collection of `Expr`'s. |
| 66 | /// |
no test coverage detected
searching dependent graphs…