pan3793 commented on code in PR #7256:
URL: https://github.com/apache/kyuubi/pull/7256#discussion_r2554740974


##########
extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/SparkSessionProvider.scala:
##########
@@ -85,26 +84,29 @@ trait SparkSessionProvider {
 
   protected val sql: String => DataFrame = spark.sql
 
-  protected def doAs[T](user: String, f: => T): T = {
+  protected def doAs[T](user: String, f: => T, unused: String = ""): T = {
     UserGroupInformation.createRemoteUser(user).doAs[T](
       new PrivilegedExceptionAction[T] {
         override def run(): T = f
       })
   }
+
+  protected def doAs[T](user: String)(f: => T): T = {
+    UserGroupInformation.createRemoteUser(user).doAs[T](
+      new PrivilegedExceptionAction[T] {
+        override def run(): T = f
+      })
+  }
+
   protected def withCleanTmpResources[T](res: Seq[(String, String)])(f: => T): 
T = {
     try {
       f
     } finally {
       res.foreach {
-        case (t, "table") => doAs(
-            admin, {
-              val purgeOption =
-                if (isCatalogSupportPurge(
-                    spark.sessionState.catalogManager.currentCatalog.name())) {
-                  "PURGE"
-                } else ""
-              sql(s"DROP TABLE IF EXISTS $t $purgeOption")
-            })
+        case (t, "table") => doAs(admin) {
+            val purgeOption = if (supportPurge) "PURGE" else ""
+            sql(s"DROP TABLE IF EXISTS $t $purgeOption")
+          }

Review Comment:
   `def doAs[T](user: String)(f: => T)` has more pretty format here.



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