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/30 07:31:44 UTC

[kyuubi] branch master updated: [KYUUBI #4899] [AUTHZ] Extract function from FunctionIdentifier for CreateFunction and DropFunction in Spark 3.4

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 eb5b07b9a [KYUUBI #4899] [AUTHZ] Extract function from FunctionIdentifier for CreateFunction and DropFunction in Spark 3.4
eb5b07b9a is described below

commit eb5b07b9a7714bc16d7cd43ce248dedebbc7aa4d
Author: liangbowen <li...@gf.com.cn>
AuthorDate: Tue May 30 15:31:31 2023 +0800

    [KYUUBI #4899] [AUTHZ] Extract function from FunctionIdentifier for CreateFunction and DropFunction in Spark 3.4
    
    ### _Why are the changes needed?_
    
    - adapting changes in logical plan of CreateFunction/DropFunction  in Spark 3.4 by extracting table object from `FunctionIdentifier`, to fix tests on Spark 3.4
      - ut "CreateFunctionCommand"
      - ut "DropFunctionCommand"
    
    ### _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 #4899 from bowenliang123/authz-functionid.
    
    Closes #4899
    
    464d3eb3d [liangbowen] apply FunctionIdentifierFunctionTypeExtractor to CreateFunction/DropFunction
    
    Authored-by: liangbowen <li...@gf.com.cn>
    Signed-off-by: liangbowen <li...@gf.com.cn>
---
 .../src/main/resources/function_command_spec.json    | 20 ++++++++++++++++++++
 .../plugin/spark/authz/gen/FunctionCommands.scala    |  8 ++++++--
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/extensions/spark/kyuubi-spark-authz/src/main/resources/function_command_spec.json b/extensions/spark/kyuubi-spark-authz/src/main/resources/function_command_spec.json
index c93985614..0b71245d2 100644
--- a/extensions/spark/kyuubi-spark-authz/src/main/resources/function_command_spec.json
+++ b/extensions/spark/kyuubi-spark-authz/src/main/resources/function_command_spec.json
@@ -1,6 +1,16 @@
 [ {
   "classname" : "org.apache.spark.sql.execution.command.CreateFunctionCommand",
   "functionDescs" : [ {
+    "fieldName" : "identifier",
+    "fieldExtractor" : "FunctionIdentifierFunctionExtractor",
+    "databaseDesc" : null,
+    "functionTypeDesc" : {
+      "fieldName" : "isTemp",
+      "fieldExtractor" : "TempMarkerFunctionTypeExtractor",
+      "skipTypes" : [ "TEMP" ]
+    },
+    "isInput" : false
+  }, {
     "fieldName" : "functionName",
     "fieldExtractor" : "StringFunctionExtractor",
     "databaseDesc" : {
@@ -44,6 +54,16 @@
 }, {
   "classname" : "org.apache.spark.sql.execution.command.DropFunctionCommand",
   "functionDescs" : [ {
+    "fieldName" : "identifier",
+    "fieldExtractor" : "FunctionIdentifierFunctionExtractor",
+    "databaseDesc" : null,
+    "functionTypeDesc" : {
+      "fieldName" : "isTemp",
+      "fieldExtractor" : "TempMarkerFunctionTypeExtractor",
+      "skipTypes" : [ "TEMP" ]
+    },
+    "isInput" : false
+  }, {
     "fieldName" : "functionName",
     "fieldExtractor" : "StringFunctionExtractor",
     "databaseDesc" : {
diff --git a/extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/gen/FunctionCommands.scala b/extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/gen/FunctionCommands.scala
index 46c7f0efa..1822e80fc 100644
--- a/extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/gen/FunctionCommands.scala
+++ b/extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/gen/FunctionCommands.scala
@@ -35,8 +35,12 @@ object FunctionCommands {
       "functionName",
       classOf[StringFunctionExtractor],
       Some(databaseDesc),
-      Some(functionTypeDesc))
-    FunctionCommandSpec(cmd, Seq(functionDesc), CREATEFUNCTION)
+      functionTypeDesc = Some(functionTypeDesc))
+    val functionIdentifierDesc = FunctionDesc(
+      "identifier",
+      classOf[FunctionIdentifierFunctionExtractor],
+      functionTypeDesc = Some(functionTypeDesc))
+    FunctionCommandSpec(cmd, Seq(functionIdentifierDesc, functionDesc), CREATEFUNCTION)
   }
 
   val DescribeFunction = {