jonahgao commented on code in PR #12467: URL: https://github.com/apache/datafusion/pull/12467#discussion_r1764569717
########## datafusion/common/src/dfschema.rs: ########## @@ -412,17 +412,32 @@ impl DFSchema { } } + /// Check whether the column reference is ambiguous + pub fn check_ambiguous_name( Review Comment: I think the newly introduced functions `qualified_field_with_qualified_name` and `qualified_fields_with_qualified_name` do more than what we need. They might be unnecessary. If I understand correctly, this function can be implemented as follows: ```rust 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(()) } } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org