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

Function resolve_columns

datafusion/sql/src/utils.rs:45–63  ·  view source on GitHub ↗

Make a best-effort attempt at resolving all columns in the expression tree

(expr: &Expr, plan: &LogicalPlan)

Source from the content-addressed store, hash-verified

43
44/// Make a best-effort attempt at resolving all columns in the expression tree
45pub(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///

Callers 2

select_to_planMethod · 0.85
aggregateMethod · 0.85

Calls 6

transform_upMethod · 0.80
ColumnClass · 0.50
dataMethod · 0.45
cloneMethod · 0.45
schemaMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…