bowenliang123 commented on code in PR #5055:
URL: https://github.com/apache/kyuubi/pull/5055#discussion_r1285290014
##########
extensions/spark/kyuubi-spark-authz/src/main/scala/org/apache/kyuubi/plugin/spark/authz/PrivilegesBuilder.scala:
##########
@@ -220,15 +220,24 @@ object PrivilegesBuilder {
plan: LogicalPlan,
spark: SparkSession): PrivilegesAndOpType = {
val inputObjs = new ArrayBuffer[PrivilegeObject]
- // TODO: add support for Spark 3.4.x
- plan transformAllExpressions {
- case hiveFunction: Expression if isKnownFunction(hiveFunction) =>
- val functionSpec: ScanSpec = getFunctionSpec(hiveFunction)
- if
(functionSpec.functionDescs.exists(!_.functionTypeDesc.get.skip(hiveFunction,
spark))) {
- functionSpec.functions(hiveFunction).foreach(func =>
- inputObjs += PrivilegeObject(func))
+ plan match {
+ case command: Command if isKnownTableCommand(command) =>
+ val spec = getTableCommandSpec(command)
+ spec.queries(plan)
+ .map(plan => buildFunctions(plan, spark)._1)
+ .reduce(_ ++ _)
+ .foreach(functionPriv => inputObjs += functionPriv)
Review Comment:
Maybe separate the output of `buildFunctions` and the following operations
for better understanding. Hence, it implies that only input objects are
appended. Output objects could be considered in the future.
--
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]