sarutak commented on a change in pull request #31754:
URL: https://github.com/apache/spark/pull/31754#discussion_r590018226
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/unresolved.scala
##########
@@ -141,8 +140,7 @@ case class UnresolvedTableValuedFunction(
*/
case class UnresolvedAttribute(nameParts: Seq[String]) extends Attribute with
Unevaluable {
- def name: String =
- nameParts.map(n => if (n.contains(".")) s"`$n`" else n).mkString(".")
+ def name: String = nameParts.map(n => if (n.contains(".")) s"`$n`" else
n).mkString(".")
Review comment:
I think it's correct that `($"`a.b`.c".expr.sql)` returns ``` `a.b`.`c`
```.
For `UnresolvedAttribute`, we can specify each name part split by `::` so
it's not necessary to quote them.
For `$"name"` or `col()`, we can just pass single string so we need to quote
manually.
By the way, I've already noticed that we can't write like
```
$```a.b``` or col(```a.b```)
```
because `UnresolvedAttribute.parseAttributeName` doesn't handle escaped
names properly.
I believe it's a bug but it's out of scope of this PR and I'll fix it in
another PR.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]