dtenedor commented on code in PR #54076:
URL: https://github.com/apache/spark/pull/54076#discussion_r2760481032


##########
sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSetCatalogCommand.scala:
##########
@@ -32,8 +32,13 @@ object ResolveSetCatalogCommand extends Rule[LogicalPlan] {
     case cmd @ SetCatalogCommand(expr) =>
       val resolvedExpr = expr match {
         case UnresolvedAttribute(nameParts) =>
-          // Convert `SET CATALOG foo` into Literal("foo").
-          Literal(nameParts.mkString("."))
+          // Convert `SET CATALOG foo` into Literal("`foo`").
+          // Wrap each identifier part with backticks to handle special 
characters.
+          // Escape any existing backticks in the identifier name by doubling 
them.
+          Literal(nameParts.map { part =>
+            val escaped = part.replace("`", "``")

Review Comment:
   It looks like similar functionality already exists in QuotingUtils.scala, 
can we consolidate?
   
   
https://github.com/apache/spark/blob/9788c52426df29fe4d145255f7a7f945bee96d3a/sql/api/src/main/scala/org/apache/spark/sql/catalyst/util/QuotingUtils.scala#L36-L40



-- 
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]

Reply via email to