EnricoMi commented on code in PR #38256:
URL: https://github.com/apache/spark/pull/38256#discussion_r995495785
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/namedExpressions.scala:
##########
@@ -75,7 +75,7 @@ trait NamedExpression extends Expression {
* multiple qualifiers, it is possible that there are other possible way to
refer to this
* attribute.
*/
- def qualifiedName: String = (qualifier :+ name).mkString(".")
+ def qualifiedName: String = (qualifier :+
name).map(quoteIfNeeded).mkString(".")
Review Comment:
Currently, `unresolvedAttributeError` calls into `toSQLId(String)`, which
expects quoted parts in a single string. It splits the string on `.` while
considering quotation. So parts need quotes if they contain `.`. With
`quoteIfNeeded` in `qualifiedName`, the parts are quoted if they contain `.`,
before the parts are joined with `.`s to a single string.
I also thought about calling into `toSQLId(Seq[String])` by mapping the
single candidate to `Seq(candidate)`, which fixes this as well. That looks like
the least impact solution. But if `qualifiedName` needs to be fixed anyway,
touching `unresolvedAttributeError` would not be needed then.
--
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]