Skip to content

[Bug] Iceberg ranger test case compatible error #7070

Open
@davidyuan1223

Description

@davidyuan1223

Code of Conduct

Search before asking

  • I have searched in the issues and found no similar issues.

Describe the bug

Currently iceberg ranger test use hadoop type catalog to test the permission, but the hadoop type has some compatible questions with alter table rename command and create view command
test case

  test("RENAME TABLE for Iceberg") {
    val table = s"$catalogV2.$namespace1.partitioned_table"
    val newTable = s"$catalogV2.$namespace1.renamed_table"
    withCleanTmpResources(Seq((table, "table"), (newTable, "table"))) {
      doAs(
        admin,
        sql(
          s"CREATE TABLE $table (id int NOT NULL, name string, city string) USING iceberg"))
      val renameTableSql = s"ALTER TABLE $table RENAME TO $newTable"
      interceptEndsWith[AccessControlException] {
        doAs(someone, sql(renameTableSql))
      }(s"does not have [alter] privilege on [$namespace1/partitioned_table]")
      doAs(admin, sql(renameTableSql))
    }
  }

  test("CREATE VIEW for Iceberg") {
    val table = s"$catalogV2.$namespace1.partitioned_table"
    val view = s"$catalogV2.$namespace1.test_view"
    withCleanTmpResources(Seq((table, "table"), (view, "view"))) {
      doAs(
        admin,
        sql(
          s"CREATE TABLE $table (id int NOT NULL, name string, city string) USING iceberg"))
      doAs(admin, sql(s"INSERT INTO $table VALUES (1, 'test', 'city')"))
      val createViewSql = s"CREATE VIEW $view AS SELECT * FROM $table"
      interceptEndsWith[AccessControlException] {
        doAs(someone, sql(createViewSql))
      }(s"does not have [create] privilege on [$namespace1]")
      doAs(admin, sql(createViewSql))
    }
  }

Affects Version(s)

master

Kyuubi Server Log Output

# Hadoop Type Catalog
Cannot rename Hadoop tables
java.lang.UnsupportedOperationException: Cannot rename Hadoop tables
---------------------------
Creating a view is not supported by catalog: local
java.lang.UnsupportedOperationException: Creating a view is not supported by catalog: local

# cancel Hadoop Type Catalog, use hive, code could see additional context
org.apache.iceberg.hive.RuntimeMetaException: Failed to connect to Hive Metastore
....
Caused by: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
....
Caused by: MetaException(message:Unable to open a test connection to the given database. JDBC url = jdbc:derby:;databaseName=/var/folders/dz/wcf2hy112t1_zw142j3lqr6c0000gn/T/hms-f1c6c83d-7435-4f0d-9641-7dbb392eee87;create=true, username = APP. Terminating connection pool (set lazyInit to true if you expect to start your database after your app). Original Exception: ------
java.sql.SQLException: Failed to start database '/var/folders/dz/wcf2hy112t1_zw142j3lqr6c0000gn/T/hms-f1c6c83d-7435-4f0d-9641-7dbb392eee87' with class loader sun.misc.Launcher$AppClassLoader@18b4aac2, see the next exception for details.
....
Caused by: ERROR XSDB6: Another instance of Derby may have already booted the database /private/var/folders/dz/wcf2hy112t1_zw142j3lqr6c0000gn/T/hms-f1c6c83d-7435-4f0d-9641-7dbb392eee87.

Kyuubi Engine Log Output

Kyuubi Server Configurations

Kyuubi Engine Configurations

Additional context

remove the hadoop

  override def beforeAll(): Unit = {
    spark.conf.set(
      s"spark.sql.catalog.$catalogV2",
      "org.apache.iceberg.spark.SparkCatalog")
    spark.conf.set(
      s"spark.sql.catalog.$catalogV2.warehouse",
      Utils.createTempDir("iceberg-hadoop").toString)

Are you willing to submit PR?

  • Yes. I would be willing to submit a PR with guidance from the Kyuubi community to fix.
  • No. I cannot submit a PR at this time.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions