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

Function extract_aliases

datafusion/sql/src/utils.rs:195–203  ·  view source on GitHub ↗

Returns mapping of each alias (`String`) to the expression (`Expr`) it is aliasing.

(exprs: &[Expr])

Source from the content-addressed store, hash-verified

193/// Returns mapping of each alias (`String`) to the expression (`Expr`) it is
194/// aliasing.
195pub(crate) fn extract_aliases(exprs: &[Expr]) -> HashMap<String, Expr> {
196 exprs
197 .iter()
198 .filter_map(|expr| match expr {
199 Expr::Alias(Alias { expr, name, .. }) => Some((name.clone(), *expr.clone())),
200 _ => None,
201 })
202 .collect::<HashMap<String, Expr>>()
203}
204
205/// Given an expression that's literal int encoding position, lookup the corresponding expression
206/// in the select_exprs list, if the index is within the bounds and it is indeed a position literal,

Callers 1

select_to_planMethod · 0.85

Calls 2

iterMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…