Skip to content

[Bug] Iceberg ranger test case compatible error #7070

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
3 of 4 tasks
davidyuan1223 opened this issue May 20, 2025 · 12 comments
Open
3 of 4 tasks

[Bug] Iceberg ranger test case compatible error #7070

davidyuan1223 opened this issue May 20, 2025 · 12 comments
Labels
kind:bug This is a clearly a bug priority:major

Comments

@davidyuan1223
Copy link
Contributor

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.
@davidyuan1223 davidyuan1223 added kind:bug This is a clearly a bug priority:major labels May 20, 2025
@davidyuan1223
Copy link
Contributor Author

@bowenliang123 @pan3793 @yaooqinn please check this issue, i cannot resolve it.

@yaooqinn
Copy link
Member

Is hive catalog OK to use for this case?

@davidyuan1223
Copy link
Contributor Author

Is hive catalog OK to use for this case?

I think it should be ok,but the derby(memory or file) will has some compatible errors.

@yaooqinn
Copy link
Member

Let's give it a try?

@davidyuan1223
Copy link
Contributor Author

Let's give it a try?

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.

This is the hive error

@yaooqinn
Copy link
Member

This Derby means you try to initiate 2 db instances in the same directory, it can be fixed in many ways

@davidyuan1223
Copy link
Contributor Author

This Derby means you try to initiate 2 db instances in the same directory, it can be fixed in many ways

I think you are right,but i have tried many ways,always report error

@pan3793
Copy link
Member

pan3793 commented May 21, 2025

Iceberg has a pool for the Hive client, disabling it might help.

@davidyuan1223
Copy link
Contributor Author

Iceberg has a pool for the Hive client, disabling it might help.

sorry, i'm not good at derby, i cannot find the root case, there has a pr #7071 , i remove the hadoop type conf, you could see the error report

@baotran306
Copy link

baotran306 commented May 26, 2025

Hi team @davidyuan1223 @yaooqinn @pan3793, I hope you're all doing well. Any updates on this issue?

@davidyuan1223
Copy link
Contributor Author

Hi team @davidyuan1223 @yaooqinn @pan3793, I hope you're all doing well. Any updates on this issue?

Sorry. I'm busy recently. Maybe next month try to resolve it?

@nqvuong1998
Copy link

nqvuong1998 commented May 27, 2025

Hi @pan3793 @yaooqinn @davidyuan1223 , I observed that Iceberg-HadoopCatalog does not fully support Iceberg syntax, such as RENAME TABLE and CREATE VIEW. However, I attempted to switch to Iceberg-HiveCatalog (embedded Derby), but encountered a known issue: apache/iceberg#7847 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug This is a clearly a bug priority:major
Projects
None yet
Development

No branches or pull requests

5 participants