goldmedal commented on code in PR #11562:
URL: https://github.com/apache/datafusion/pull/11562#discussion_r1686658173
##########
datafusion/sql/src/expr/identifier.rs:
##########
@@ -47,40 +47,58 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
// compound identifiers, but this is not a compound
// identifier. (e.g. it is "foo.bar" not foo.bar)
let normalize_ident = self.normalizer.normalize(id);
- match schema.field_with_unqualified_name(normalize_ident.as_str())
{
- Ok(_) => {
- // found a match without a qualified name, this is a inner
table column
- Ok(Expr::Column(Column {
- relation: None,
+
+ // Check for qualified field with unqualified name
+ if let Ok((Some(qualifier), _)) =
+
schema.qualified_field_with_unqualified_name(normalize_ident.as_str())
+ {
+ let is_unnamed_table = match &qualifier {
+ TableReference::Bare { table } => table.as_ref() ==
UNNAMED_TABLE,
+ TableReference::Partial { table, .. } => {
+ table.as_ref() == UNNAMED_TABLE
+ }
+ TableReference::Full { table, .. } => table.as_ref() ==
UNNAMED_TABLE,
+ };
Review Comment:
👍
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]