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


##########
extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/ranger/RangerSparkExtensionSuite.scala:
##########
@@ -747,4 +747,29 @@ class HiveCatalogRangerSparkExtensionSuite extends 
RangerSparkExtensionSuite {
       assert(e.getMessage.contains(s"does not have [select] privilege on 
[$db1/$table/id]"))
     }
   }
+
+  test("[KYUUBI #5417] should not check dependent subquery plan privilege") {
+    val db1 = defaultDb
+    val table1 = "table1"
+    val table2 = "table2"
+    val view1 = "view1"
+    withCleanTmpResources(
+      Seq((s"$db1.$table1", "table"), (s"$db1.$table2", "table"), 
(s"$db1.$view1", "view"))) {
+      doAs(admin, sql(s"CREATE TABLE IF NOT EXISTS $db1.$table1 (id int, scope 
int)"))
+      doAs(admin, sql(s"CREATE TABLE IF NOT EXISTS $db1.$table2 (id int, scope 
int)"))
+      doAs(admin, sql(
+        s"""
+           |CREATE VIEW $db1.$view1
+           |AS
+           |WITH temp AS (
+           |    SELECT max(scope) max_scope
+           |    FROM $db1.$table1)
+           |SELECT id as new_id FROM $db1.$table2
+           |WHERE scope = (SELECT max_scope FROM temp)
+           |""".stripMargin))
+      val e = intercept[AccessControlException](
+        doAs(someone, sql(s"SELECT * FROM $db1.$view1".stripMargin).show()))
+      assert(e.getMessage.contains(s"does not have [select] privilege on 
[$db1/$view1/new_id]"))

Review Comment:
   +1. Sounds like the difference is the CTE for the views.



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