lunar-shadow commented on code in PR #55547:
URL: https://github.com/apache/spark/pull/55547#discussion_r3152979824


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Strategy.scala:
##########
@@ -448,14 +448,32 @@ class DataSourceV2Strategy(session: SparkSession) extends 
Strategy with Predicat
     case _: NoopCommand =>
       LocalTableScanExec(Nil, Nil, None) :: Nil
 
-    case RenameTable(r @ ResolvedTable(catalog, oldIdent, _, _), newIdent, 
isView) =>
+    case RenameTable(r @ ResolvedTable(catalog, oldIdent, _, _), 
rawNewNameParts, isView) =>
       if (isView) {
         throw QueryCompilationErrors.cannotRenameTableWithAlterViewError()
       }
+
+      // Strip catalog prefix if the identifier is catalog-qualified.
+      val newNameParts =
+        if (rawNewNameParts.length > 1 && rawNewNameParts.head == 
catalog.name()) {
+          rawNewNameParts.tail
+        } else {
+          rawNewNameParts

Review Comment:
    Yes, both `RENAME TO testcat.ns.t1_renamed` and `RENAME TO TesTcaT.ns.t1` 
in the test hit this code path. 



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