Skip to content

Conversation

difin
Copy link
Contributor

@difin difin commented Sep 29, 2025

What changes were proposed in this pull request?

Implemented a new qtest-driverTestIcebergRESTCatalogGravitinoLlapLocalCliDriver for testing HiveRESTCatalogClient with Gravitino Iceberg Rest Server and a q-test for it.

Why are the changes needed?

To validate support for external RestCatalogs like Gravitino.

Does this PR introduce any user-facing change?

No

How was this patch tested?

New q-test.

@zhangbutao
Copy link
Contributor

Hi @difin, Can we use the standalone HMS instead Gravitino as the Iceberg REST server for E2E testing?

@deniskuzZ
Copy link
Member

deniskuzZ commented Sep 30, 2025

Hi @difin, Can we use the standalone HMS instead Gravitino as the Iceberg REST server for E2E testing?

@zhangbutao, we already have a test for HMS RestCatalog (iceberg_rest_catalog_hms.q).
This PR aims to validate support for external RestCatalogs like Gravitino (iceberg_rest_catalog_gravitino.q).

@difin difin force-pushed the rest_client_gravitino branch from c949a61 to f3abd30 Compare September 30, 2025 15:11
@difin difin force-pushed the rest_client_gravitino branch from f3abd30 to 0497faa Compare September 30, 2025 20:14
@difin difin force-pushed the rest_client_gravitino branch from 0497faa to b604394 Compare September 30, 2025 20:51
@difin difin changed the title HIVE-29233: Iceberg: HiveRESTCatalogClient test with Gravitino Iceberg Rest Server HIVE-29233: Iceberg: Validate HiveRESTCatalogClient test external RESTCatalogs like Gravitino Sep 30, 2025
@difin difin changed the title HIVE-29233: Iceberg: Validate HiveRESTCatalogClient test external RESTCatalogs like Gravitino HIVE-29233: Iceberg: Validate HiveRESTCatalogClient with external RESTCatalogs like Gravitino Sep 30, 2025
@difin difin force-pushed the rest_client_gravitino branch from b604394 to 8656b64 Compare September 30, 2025 20:58
@difin difin force-pushed the rest_client_gravitino branch from 8656b64 to 54bb487 Compare October 1, 2025 03:56
@okumin
Copy link
Contributor

okumin commented Oct 1, 2025

I checked out this branch and ran mvn test -Pitests -pl itests/qtest-iceberg -Dtest=TestIcebergRESTCatalogGravitinoLlapLocalCliDriver.java -Dtest.output.overwrite=false -Dqfile_regex=iceberg_rest_catalog_gravitino. I received 500 probably from Gravitino. I'm waiting for CI to conclude if it is my local issue or not

See ./ql/target/tmp/log/hive.log or ./itests/qtest/target/tmp/log/hive.log, or check ./ql/target/surefire-reports or ./itests/qtest/target/surefire-reports/ for specific test cases logs.
 MetaException(message:Server error: null: {
"servlet":"org.glassfish.jersey.servlet.ServletContainer-324c64cd",
"message":"org.glassfish.jersey.server.ContainerException: java.lang.NoSuchMethodError: 'void org.apache.hadoop.security.HadoopKerberosName.setRuleMechanism(java.lang.String)'",
"url":"/iceberg/v1/config",
"status":"500"
})```

<artifactItem>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>2.2.224</version>
Copy link
Member

@deniskuzZ deniskuzZ Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${h2database.version}, property is defined in a root pom

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

--! qt:replace:/(\S\"iceberg-version\\\":\\\")(\w+\s\w+\s\d+\.\d+\.\d+\s\(\w+\s\w+\))(\\\")/$1#Masked#$3/

set hive.stats.autogather=false;
set metastore.client.impl=org.apache.iceberg.hive.client.HiveRESTCatalogClient;
Copy link
Member

@deniskuzZ deniskuzZ Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we set these configs in the Driver, similar to iceberg.catalog.ice01.uri?

ice01 is hardcoded there anyways: https://github.com/apache/hive/pull/6108/files#diff-398be9698c49244815af06140fe75eaaeef75ec6e497a74b8953cbda334bf122R122

  • metastore.client.impl
  • metastore.catalog.default
  • iceberg.catalog.ice01.type

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These configs are set in the driver too.
I added them here in q-test just for clarity to make them visible in the q-test itself.
Do you think it is better to keep them only in the driver?


if (warehouseDir != null && Files.exists(warehouseDir)) {
try (var paths = Files.walk(warehouseDir)) {
paths.sorted(Comparator.reverseOrder())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use FileUtils.cleanDirectory(warehouseDir) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done using .deleteDirectory().

cleanDirectory(dir) → empties the folder but leaves the folder in place.
deleteDirectory(dir) → deletes the folder and everything under it.

@@ -0,0 +1,14 @@
gravitino.iceberg-rest.httpPort = 9001
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we read this config in Driver?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, made it configurable like the warehouseDir.

* to avoid overwriting container data.</p>
*/
private void startWarehouseDirSync() {
fileSyncExecutor.scheduleAtFixedRate(() -> {
Copy link
Member

@deniskuzZ deniskuzZ Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we refactor

fileSyncExecutor.scheduleAtFixedRate(this::syncWarehouseDir, 0, 5, TimeUnit.SECONDS);

private void syncWarehouseDir() {
    if (!gravitinoContainer.isRunning()) {
        return;
    }
    // The try-with-resources block handles the core logic
    try (/*... setup TarArchiveInputStream ...*/) {
        // ... (rest of the sync logic)
    } catch (Exception e) {
        LOG.error("Warehouse folder sync failed: {}", e.getMessage());
    }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to copy checkstyle/asf.header or change the template

https://sonarcloud.io/project/issues?sinceLeakPeriod=true&issueStatuses=OPEN%2CCONFIRMED&pullRequest=6108&id=apache_hive&open=AZmX8jO00mHwehPdTX0p

I'm trying to modify existing files. So far, we need to add exact headers to new files.
https://issues.apache.org/jira/browse/HIVE-29245

Copy link
Contributor

@okumin okumin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

sonarqubecloud bot commented Oct 6, 2025

@difin difin merged commit d46d900 into apache:master Oct 6, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants