jonahgao commented on code in PR #12467: URL: https://github.com/apache/datafusion/pull/12467#discussion_r1763427751
########## datafusion/sql/src/expr/identifier.rs: ########## @@ -186,7 +186,22 @@ 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(); - Ok(Expr::Column(Column::new(relation, column_name))) + // sanity check on column Review Comment: As the comment says, how about adding a `check_ambiguous_qualified_name` method to `DFSchema`? I think this would be more intuitive and simpler. The code here can be changed to the following. ```rust // sanity check on column schema.check_ambiguous_qualified_name(relation.as_ref(), column_name)?; Ok(Expr::Column(Column::new(relation, column_name))) ``` `check_ambiguous_qualified_name` is used to check whether the specified qualified name appears multiple times in the schema. I suspect that we should not allow two identical qualified fields within a schema, but this would violate PR 6091. Therefore, introducing a method like `check_ambiguous_qualified_name` to be called when needed might be a workaround. -- 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