Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions datafusion/common/src/dfschema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,33 +406,6 @@ impl DFSchema {
}
}

/// Check whether the column reference is ambiguous
pub fn check_ambiguous_name(
&self,
qualifier: Option<&TableReference>,
name: &str,
) -> Result<()> {
let count = self
.iter()
.filter(|(field_q, f)| match (field_q, qualifier) {
(Some(q1), Some(q2)) => q1.resolved_eq(q2) && f.name() == name,
(None, None) => f.name() == name,
_ => false,
})
.take(2)
.count();
if count > 1 {
_schema_err!(SchemaError::AmbiguousReference {
field: Column {
relation: None,
name: name.to_string(),
},
})
} else {
Ok(())
}
}

/// Find the qualified field with the given name
pub fn qualified_field_with_name(
&self,
Expand Down
8 changes: 0 additions & 8 deletions datafusion/sql/src/expr/identifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
) {
match planner_result {
PlannerResult::Planned(expr) => {
// sanity check on column
schema
.check_ambiguous_name(qualifier, field.name())?;
return Ok(expr);
}
PlannerResult::Original(_args) => {}
Expand All @@ -139,8 +136,6 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
}
// found matching field with no spare identifier(s)
Some((field, qualifier, _nested_names)) => {
// sanity check on column
schema.check_ambiguous_name(qualifier, field.name())?;
Ok(Expr::Column(Column::from((qualifier, field))))
}
None => {
Expand Down Expand Up @@ -184,9 +179,6 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
let s = &ids[0..ids.len()];
// safe unwrap as s can never be empty or exceed the bounds
let (relation, column_name) = form_identifier(s).unwrap();
// sanity check on column
schema
.check_ambiguous_name(relation.as_ref(), column_name)?;
Ok(Expr::Column(Column::new(relation, column_name)))
}
}
Expand Down