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

Function validate_unique_names

datafusion/expr/src/logical_plan/builder.rs:1872–1893  ·  view source on GitHub ↗

Errors if one or more expressions have equal names.

(
    node_name: &str,
    expressions: impl IntoIterator<Item = &'a Expr>,
)

Source from the content-addressed store, hash-verified

1870
1871/// Errors if one or more expressions have equal names.
1872pub fn validate_unique_names<'a>(
1873 node_name: &str,
1874 expressions: impl IntoIterator<Item = &'a Expr>,
1875) -> Result<()> {
1876 let mut unique_names = HashMap::new();
1877
1878 expressions.into_iter().enumerate().try_for_each(|(position, expr)| {
1879 let name = expr.schema_name().to_string();
1880 match unique_names.get(&name) {
1881 None => {
1882 unique_names.insert(name, (position, expr));
1883 Ok(())
1884 },
1885 Some((existing_position, existing_expr)) => {
1886 plan_err!("{node_name} require unique expression names \
1887 but the expression \"{existing_expr}\" at position {existing_position} and \"{expr}\" \
1888 at position {position} have the same name. Consider aliasing (\"AS\") one of them."
1889 )
1890 }
1891 }
1892 })
1893}
1894
1895/// Union two [`LogicalPlan`]s.
1896///

Callers 2

windowMethod · 0.85
project_with_validationFunction · 0.85

Calls 6

newFunction · 0.85
into_iterMethod · 0.45
to_stringMethod · 0.45
schema_nameMethod · 0.45
getMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…