You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by bo...@apache.org on 2023/05/26 08:49:55 UTC

[kyuubi] branch master updated: [KYUUBI #4888] [AUTHZ] Remove filtering results for ShowDatabasesCommand in Spark 2.x

This is an automated email from the ASF dual-hosted git repository.

bowenliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new 151b2eaec [KYUUBI #4888] [AUTHZ] Remove filtering results for ShowDatabasesCommand in Spark 2.x
151b2eaec is described below

commit 151b2eaec29c33a28116b159959f904c1c505531
Author: liangbowen <li...@gf.com.cn>
AuthorDate: Fri May 26 16:49:43 2023 +0800

    [KYUUBI #4888] [AUTHZ] Remove filtering results for ShowDatabasesCommand in Spark 2.x
    
    ### _Why are the changes needed?_
    
    - remove FilteredShowDatabasesCommand for filtering "show databases" in Spark 2.x, as ShowDatabasesCommand is removed since Spark 3.0
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [x] [Run test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests) locally before make a pull request
    
    Closes #4888 from bowenliang123/remove-showdatabasecommand.
    
    Closes #4888
    
    d4ae60bc1 [liangbowen] remove FilteredShowDatabasesCommand for filtering show database in spark 2.4
    
    Authored-by: liangbowen <li...@gf.com.cn>
    Signed-off-by: liangbowen <li...@gf.com.cn>
---
 .../authz/ranger/RuleReplaceShowObjectCommands.scala      | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/extensions/spark/kyuubi-spark-authz/src/main/scala/org/apache/kyuubi/plugin/spark/authz/ranger/RuleReplaceShowObjectCommands.scala b/extensions/spark/kyuubi-spark-authz/src/main/scala/org/apache/kyuubi/plugin/spark/authz/ranger/RuleReplaceShowObjectCommands.scala
index 4f72ecfee..6e86ab9fb 100644
--- a/extensions/spark/kyuubi-spark-authz/src/main/scala/org/apache/kyuubi/plugin/spark/authz/ranger/RuleReplaceShowObjectCommands.scala
+++ b/extensions/spark/kyuubi-spark-authz/src/main/scala/org/apache/kyuubi/plugin/spark/authz/ranger/RuleReplaceShowObjectCommands.scala
@@ -33,9 +33,6 @@ class RuleReplaceShowObjectCommands extends Rule[LogicalPlan] {
     case r: RunnableCommand if r.nodeName == "ShowTablesCommand" => FilteredShowTablesCommand(r)
     case n: LogicalPlan if n.nodeName == "ShowTables" =>
       ObjectFilterPlaceHolder(n)
-    // show databases in spark2.4.x
-    case r: RunnableCommand if r.nodeName == "ShowDatabasesCommand" =>
-      FilteredShowDatabasesCommand(r)
     case n: LogicalPlan if n.nodeName == "ShowNamespaces" =>
       ObjectFilterPlaceHolder(n)
     case r: RunnableCommand if r.nodeName == "ShowFunctionsCommand" =>
@@ -64,18 +61,6 @@ case class FilteredShowTablesCommand(delegated: RunnableCommand)
   }
 }
 
-case class FilteredShowDatabasesCommand(delegated: RunnableCommand)
-  extends FilteredShowObjectCommand(delegated) {
-
-  override protected def isAllowed(r: Row, ugi: UserGroupInformation): Boolean = {
-    val database = r.getString(0)
-    val resource = AccessResource(ObjectType.DATABASE, database, null, null)
-    val request = AccessRequest(resource, ugi, OperationType.SHOWDATABASES, AccessType.USE)
-    val result = SparkRangerAdminPlugin.isAccessAllowed(request)
-    result != null && result.getIsAllowed
-  }
-}
-
 abstract class FilteredShowObjectCommand(delegated: RunnableCommand)
   extends RunnableCommand with WithInternalChildren {