apache / kyuubi

Apache Kyuubi is a distributed and multi-tenant gateway to provide serverless SQL on data warehouses and lakehouses.
https://kyuubi.apache.org/
Apache License 2.0
2.09k stars 913 forks source link

[Bug] [Authz] Failed to build and test Authz plugin with Ranger below 1.0 with failures of data masking #4450

Closed bowenliang123 closed 1 year ago

bowenliang123 commented 1 year ago

Code of Conduct

Search before asking

Describe the bug

✅ OK to build and test with Ranger 1.0+(1.1.0/1.2.0/2.1.0/2.3.0) ❌ Failed to build and test Authz plugin with either 0.6.0 or 0.7.0.

build/mvn clean package -pl :kyuubi-spark-authz_2.12 -Pspark-3.3 -Dranger.version=0.6.0 build/mvn clean package -pl :kyuubi-spark-authz_2.12 -Pspark-3.3 -Dranger.version=0.7.0

Total number of tests run: 455
Suites: completed 18, aborted 0
Tests: succeeded 307, failed 148, canceled 37, ignored 0, pending 0
*** 148 TESTS FAILED ***
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

Affects Version(s)

1.7.0/master

Kyuubi Server Log Output

No response

Kyuubi Engine Log Output

- auth: databases *** FAILED ***
  Expected exception org.apache.kyuubi.plugin.spark.authz.AccessControlException to be thrown, but no exception was thrown (RangerSparkExtensionSuite.scala:155)
- auth: tables *** FAILED ***
  Expected exception org.apache.kyuubi.plugin.spark.authz.AccessControlException to be thrown, but no exception was thrown (RangerSparkExtensionSuite.scala:177)
- auth: functions *** FAILED ***
  Expected exception org.apache.kyuubi.plugin.spark.authz.AccessControlException to be thrown, but no exception was thrown (RangerSparkExtensionSuite.scala:215)
- row level filter *** FAILED ***
  SELECT value FROM default.src Array([1], [2], [3]) did not equal List([1]) (RangerSparkExtensionSuite.scala:248)
- [KYUUBI #3581]: row level filter on permanent view *** FAILED ***
  SELECT value FROM default.perm_view Array([1], [2], [3]) did not equal List([1]) (RangerSparkExtensionSuite.scala:291)
- show tables *** FAILED ***
  0 did not equal 2 (RangerSparkExtensionSuite.scala:310)
- show databases *** FAILED ***
  Array() had length 0 instead of expected length 2 (RangerSparkExtensionSuite.scala:321)
- show functions *** FAILED ***
  Array() had length 0 instead of expected length 1 (RangerSparkExtensionSuite.scala:340)
- show columns *** FAILED ***
  0 did not equal 2 (RangerSparkExtensionSuite.scala:367)
- show table extended *** FAILED ***
  0 did not equal 5 (RangerSparkExtensionSuite.scala:397)
- [KYUUBI #3426] Drop temp view should be skipped permission check *** FAILED ***
  Array() had length 0 instead of expected length 2 (RangerSparkExtensionSuite.scala:453)
- [KYUUBI #3428] AlterViewAsCommand should be skipped permission check *** FAILED ***
  java.lang.reflect.UndeclaredThrowableException:
  at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1894)
  at org.apache.kyuubi.plugin.spark.authz.SparkSessionProvider.doAs(SparkSessionProvider.scala:76)
  at org.apache.kyuubi.plugin.spark.authz.SparkSessionProvider.doAs$(SparkSessionProvider.scala:74)
  at org.apache.kyuubi.plugin.spark.authz.ranger.RangerSparkExtensionSuite.doAs(RangerSparkExtensionSuite.scala:37)
  at org.apache.kyuubi.plugin.spark.authz.ranger.RangerSparkExtensionSuite.$anonfun$new$138(RangerSparkExtensionSuite.scala:466)
  at org.scalatest.OutcomeOf.outcomeOf(OutcomeOf.scala:85)
  at org.scalatest.OutcomeOf.outcomeOf$(OutcomeOf.scala:83)
  at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)
  at org.scalatest.Transformer.apply(Transformer.scala:22)
  at org.scalatest.Transformer.apply(Transformer.scala:20)
  ...
  Cause: org.apache.spark.sql.catalyst.analysis.TempTableAlreadyExistsException: Temporary view 'temp_view' already exists
  at org.apache.spark.sql.catalyst.catalog.SessionCatalog.createTempView(SessionCatalog.scala:602)
  at org.apache.spark.sql.execution.command.CreateViewCommand.run(views.scala:124)
  at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult$lzycompute(commands.scala:75)
  at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult(commands.scala:73)
  at org.apache.spark.sql.execution.command.ExecutedCommandExec.executeCollect(commands.scala:84)
  at org.apache.spark.sql.execution.QueryExecution$$anonfun$eagerlyExecuteCommands$1.$anonfun$applyOrElse$1(QueryExecution.scala:98)
  at org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId$6(SQLExecution.scala:109)
  at org.apache.spark.sql.execution.SQLExecution$.withSQLConfPropagated(SQLExecution.scala:169)
  at org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId$1(SQLExecution.scala:95)
  at org.apache.spark.sql.SparkSession.withActive(SparkSession.scala:779)
  ...
- [KYUUBI #3343] pass temporary view creation *** FAILED ***
  scala.util.Try.apply[org.apache.spark.sql.DataFrame](RangerSparkExtensionSuite.this.sql.apply(scala.StringContext.apply("CREATE TEMPORARY VIEW ", " AS select * from values(1)").s(tempView))).isSuccess was false (RangerSparkExtensionSuite.scala:495)
== Physical Plan ==
CommandResult <empty>
   +- CreateNamespace org.apache.spark.sql.execution.datasources.v2.jdbc.JDBCTableCatalog@33770455, [ns2], true

- [KYUUBI #3424] CREATE DATABASE *** FAILED ***
  Expected exception org.apache.kyuubi.plugin.spark.authz.AccessControlException to be thrown, but no exception was thrown (V2JdbcTableCatalogRangerSparkExtensionSuite.scala:84)
- [KYUUBI #3424] DROP DATABASE *** FAILED ***
  Expected exception org.apache.kyuubi.plugin.spark.authz.AccessControlException to be thrown, but java.lang.reflect.UndeclaredThrowableException was thrown (V2JdbcTableCatalogRangerSparkExtensionSuite.scala:94)


### Kyuubi Server Configurations

_No response_

### Kyuubi Engine Configurations

_No response_

### Additional context

_No response_

### Are you willing to submit PR?

- [ ] Yes. I would be willing to submit a PR with guidance from the Kyuubi community to fix.
- [X] No. I cannot submit a PR at this time.
bowenliang123 commented 1 year ago

cc @yaooqinn @pan3793