yaooqinn commented on code in PR #3197:
URL: https://github.com/apache/incubator-kyuubi/pull/3197#discussion_r940033542


##########
extensions/spark/kyuubi-spark-authz/src/main/scala/org/apache/kyuubi/plugin/spark/authz/util/AuthZUtils.scala:
##########
@@ -84,6 +85,14 @@ private[authz] object AuthZUtils {
     getFieldVal[Option[CatalogTable]](plan, "catalogTable")
   }
 
+  def hasResolvedDatasourceV2Table(plan: LogicalPlan): Boolean = {
+    plan.nodeName == "DataSourceV2Relation" && plan.resolved
+  }
+
+  def getDatasourceV2Identifier(plan: LogicalPlan): Option[Identifier] = {

Review Comment:
   I don't whether it works or not, but something like this?
   ```scala
     def quoteIfNeeded(part: String): String = {
       if (part.matches("[a-zA-Z0-9_]+") && !part.matches("\\d+")) {
         part
       } else {
         s"`${part.replace("`", "``")}`"
       }
     }
   
     def quote(parts: Seq[String]): String = {
       parts.map(quoteIfNeeded).mkString(".")
     }
   
     def getDatasourceV2Identifier(plan: LogicalPlan): Option[TableIdentifier] 
= {
       val identifier = getFieldVal[Option[AnyRef]](plan, "identifier")
       identifier.map { id =>
         val namespaces = invoke(id, "namespaces").asInstanceOf[Array[String]]
         val table = invoke(id, "name").asInstanceOf[String]
         TableIdentifier(table, Some(quote(namespaces)))
       }
     }
   ```



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