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

Function create_col_from_scalar_expr

datafusion/expr/src/expr_rewriter/mod.rs:177–195  ·  view source on GitHub ↗

Create a Column from the Scalar Expr

(
    scalar_expr: &Expr,
    subqry_alias: String,
)

Source from the content-addressed store, hash-verified

175
176/// Create a Column from the Scalar Expr
177pub fn create_col_from_scalar_expr(
178 scalar_expr: &Expr,
179 subqry_alias: String,
180) -> Result<Column> {
181 match scalar_expr {
182 Expr::Alias(Alias { name, .. }) => Ok(Column::new(
183 Some::<TableReference>(subqry_alias.into()),
184 name,
185 )),
186 Expr::Column(col) => Ok(col.with_relation(subqry_alias.into())),
187 _ => {
188 let scalar_column = scalar_expr.schema_name().to_string();
189 Ok(Column::new(
190 Some::<TableReference>(subqry_alias.into()),
191 scalar_column,
192 ))
193 }
194 }
195}
196
197/// Recursively un-normalize all [`Column`] expressions in a list of expression trees
198#[inline]

Callers 3

head_output_exprMethod · 0.85
build_joinFunction · 0.85
f_downMethod · 0.85

Calls 5

newFunction · 0.85
with_relationMethod · 0.80
intoMethod · 0.45
to_stringMethod · 0.45
schema_nameMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…