This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new 48d395a9c7 Remove unnecessary `DFSchema::check_ambiguous_name` (#12805)
48d395a9c7 is described below
commit 48d395a9c7185e6cdd1d671993fcfaba0b4f1623
Author: Jonah Gao <[email protected]>
AuthorDate: Wed Oct 9 04:57:50 2024 +0800
Remove unnecessary `DFSchema::check_ambiguous_name` (#12805)
---
datafusion/common/src/dfschema.rs | 27 ---------------------------
datafusion/sql/src/expr/identifier.rs | 8 --------
2 files changed, 35 deletions(-)
diff --git a/datafusion/common/src/dfschema.rs
b/datafusion/common/src/dfschema.rs
index 69cdf866cf..9a1fe9bba2 100644
--- a/datafusion/common/src/dfschema.rs
+++ b/datafusion/common/src/dfschema.rs
@@ -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,
diff --git a/datafusion/sql/src/expr/identifier.rs
b/datafusion/sql/src/expr/identifier.rs
index b2c8312709..b016309b69 100644
--- a/datafusion/sql/src/expr/identifier.rs
+++ b/datafusion/sql/src/expr/identifier.rs
@@ -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) => {}
@@ -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 => {
@@ -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)))
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]