You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by GitBox <gi...@apache.org> on 2023/01/04 07:13:15 UTC

[GitHub] [kyuubi] bowenliang123 commented on a diff in pull request #4044: [Authz] Serde for queries

bowenliang123 commented on code in PR #4044:
URL: https://github.com/apache/kyuubi/pull/4044#discussion_r1061188043


##########
extensions/spark/kyuubi-spark-authz/src/main/scala/org/apache/kyuubi/plugin/spark/authz/serde/CommandSpec.scala:
##########
@@ -71,4 +79,33 @@ case class TableCommandSpec(
     classname: String,
     tableDescs: Seq[TableDesc],
     opType: String = "QUERY",
-    queryDescs: Seq[QueryDesc] = Nil) extends CommandSpec
+    queryDescs: Seq[QueryDesc] = Nil) extends CommandSpec {
+  def queries: LogicalPlan => Seq[LogicalPlan] = plan => {
+    queryDescs.flatMap { qd =>
+      try {
+        qd.extract(plan)
+      } catch {
+        case e: Exception =>
+          LOG.warn(qd.error(plan, e))
+          None
+      }
+    }
+  }
+}
+
+case class ScanSpec(
+    classname: String,
+    scanDescs: Seq[ScanDesc]) extends CommandSpec {
+  override def opType: String = "QUERY"

Review Comment:
   maybe extract this repeated opType "QUERY" to the object for preventing magic value? or use `OperationType.QUERY.toString`.



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org