You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "diqiu50 (via GitHub)" <gi...@apache.org> on 2026/06/10 07:03:01 UTC

[PR] [#11538] fix(catalog-glue): Support RENAME TABLE for Iceberg tables [gravitino]

diqiu50 opened a new pull request, #11555:
URL: https://github.com/apache/gravitino/pull/11555

   ### What changes were proposed in this pull request?
   
   `GlueIcebergTableHelper.alterTable` threw `IllegalArgumentException` for `RenameTable` changes because it only handled `ColumnChange`, `SetProperty`, and `RemoveProperty`. The underlying Iceberg `GlueCatalog` natively supports `renameTable`, so the capability existed but was never wired up.
   
   Changes:
   - Handle `TableChange.RenameTable` in `GlueIcebergTableHelper.alterTable` by delegating to `icebergCatalog.renameTable(from, to)`; return the final table name so callers can load the renamed table correctly.
   - Update `GlueCatalogOperations.alterIcebergTable` to use the returned name when constructing the `NameIdentifier` for the post-alter `loadTable` call.
   
   ### Why are the changes needed?
   
   Fix: #11538
   
   Users could not rename Iceberg tables in a Gravitino Glue catalog via Spark (`ALTER TABLE ... RENAME TO`) or the Java client, even though the underlying Iceberg `GlueCatalog` supports rename natively.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes — `ALTER TABLE ... RENAME TO` now works for Iceberg tables in the Glue catalog. Previously it always threw `IllegalArgumentException`.
   
   ### How was this patch tested?
   
   - Unit test: `TestGlueCatalogOperationsForIceberg#testAlterTable_icebergRenameCallsIcebergRenameTable` verifies `icebergCatalog.renameTable` is called with the correct source and target identifiers.
   - Spark AWS IT: `SparkAwsGlueCatalogIT35#testRenameIcebergTable` runs end-to-end against real AWS Glue: create Iceberg table → insert row → rename → verify old name gone, new name exists, data readable.


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#11538] fix(catalog-glue): Support RENAME TABLE for Iceberg tables [gravitino]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #11555:
URL: https://github.com/apache/gravitino/pull/11555#discussion_r3386238505


##########
catalogs/catalog-glue/src/main/java/org/apache/gravitino/catalog/glue/GlueIcebergTableHelper.java:
##########
@@ -391,9 +392,22 @@ static void createTable(
    * @param dbName the Glue database name
    * @param tableName the table name
    * @param changes the table changes to apply
+   * @return the final table name (differs from {@code tableName} only when a rename is applied)
    */
-  static void alterTable(
+  static String alterTable(
       Catalog icebergCatalog, String dbName, String tableName, TableChange... changes) {
+    for (TableChange change : changes) {
+      if (change instanceof TableChange.RenameTable) {
+        Preconditions.checkArgument(
+            changes.length == 1, "RenameTable cannot be combined with other table changes");
+        String newName = ((TableChange.RenameTable) change).getNewName();
+        icebergCatalog.renameTable(
+            TableIdentifier.of(dbName, tableName), TableIdentifier.of(dbName, newName));
+        LOG.info("Renamed Iceberg table {}.{} to {}", dbName, tableName, newName);
+        return newName;
+      }

Review Comment:
   `TableChange.RenameTable` can include an optional `newSchemaName` (see `TableChange.rename(newName, newSchemaName)`), but this implementation ignores it and always renames within the current `dbName`. If a client sends a rename that moves the table to a different schema, this will do the wrong thing (or rename to an unexpected target). Either honor `newSchemaName` in the Iceberg `TableIdentifier`, or explicitly reject cross-schema renames here.



-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#11538] fix(catalog-glue): Support RENAME TABLE for Iceberg tables [gravitino]

Posted by "mchades (via GitHub)" <gi...@apache.org>.
mchades merged PR #11555:
URL: https://github.com/apache/gravitino/pull/11555


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#11538] fix(catalog-glue): Support RENAME TABLE for Iceberg tables [gravitino]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #11555:
URL: https://github.com/apache/gravitino/pull/11555#issuecomment-4669125516

   <!-- coverage-report -->
   ### Code Coverage Report
   |Overall Project|66.93% **`-0.11%`**|:green_circle:|
   |:-|:-|:-:|
   |Files changed|56.81%|:red_circle:|
   <br>
   
   |Module|Coverage||
   |:-|:-|:-:|
   |aliyun|1.72%|:red_circle:|
   |api|46.82%|:green_circle:|
   |authorization-common|85.96%|:green_circle:|
   |aws|3.66%|:red_circle:|
   |azure|2.47%|:red_circle:|
   |catalog-common|10.4%|:red_circle:|
   |catalog-fileset|80.23%|:green_circle:|
   |catalog-glue|66.91% **`-19.08%`**|:green_circle:|
   |catalog-hive|79.44%|:green_circle:|
   |catalog-jdbc-clickhouse|80.02%|:green_circle:|
   |catalog-jdbc-common|44.22%|:green_circle:|
   |catalog-jdbc-doris|80.28%|:green_circle:|
   |catalog-jdbc-hologres|54.03%|:green_circle:|
   |catalog-jdbc-mysql|79.23%|:green_circle:|
   |catalog-jdbc-oceanbase|78.38%|:green_circle:|
   |catalog-jdbc-postgresql|82.29%|:green_circle:|
   |catalog-jdbc-starrocks|78.51%|:green_circle:|
   |catalog-kafka|77.01%|:green_circle:|
   |catalog-lakehouse-generic|58.53%|:green_circle:|
   |catalog-lakehouse-hudi|79.1%|:green_circle:|
   |catalog-lakehouse-iceberg|85.79%|:green_circle:|
   |catalog-lakehouse-paimon|79.15%|:green_circle:|
   |catalog-model|77.72%|:green_circle:|
   |cli|44.51%|:green_circle:|
   |client-java|77.91%|:green_circle:|
   |common|49.9%|:green_circle:|
   |core|82.38%|:green_circle:|
   |filesystem-hadoop3|77.27%|:green_circle:|
   |flink|0.0%|:red_circle:|
   |flink-common|45.72%|:green_circle:|
   |flink-runtime|0.0%|:red_circle:|
   |gcp|14.12%|:red_circle:|
   |hadoop-common|10.39%|:red_circle:|
   |hive-metastore-common|53.9%|:green_circle:|
   |iceberg-common|57.41%|:green_circle:|
   |iceberg-rest-server|73.69%|:green_circle:|
   |idp-basic|86.18%|:green_circle:|
   |integration-test-common|0.0%|:red_circle:|
   |jobs|66.17%|:green_circle:|
   |lance-common|20.81%|:red_circle:|
   |lance-rest-server|60.54%|:green_circle:|
   |lineage|53.02%|:green_circle:|
   |optimizer|82.95%|:green_circle:|
   |optimizer-api|21.95%|:red_circle:|
   |server|85.73%|:green_circle:|
   |server-common|73.28%|:green_circle:|
   |spark|28.57%|:red_circle:|
   |spark-common|41.16%|:green_circle:|
   |trino-connector|40.13%|:green_circle:|
   
   <details>
   <summary>Files</summary>
   
   |Module|File|Coverage||
   |:-|:-|:-|:-:|
   |catalog-glue|[GlueCatalogOperations.java](https://github.com/diqiu50/gravitino/blob/dd38a05da8b7ddf90d2460dd4069c055aede9bfa/catalogs/catalog-glue/src/main/java/org/apache/gravitino/catalog/glue/GlueCatalogOperations.java)|72.57%|:green_circle:|
   ||[GlueIcebergTableHelper.java](https://github.com/diqiu50/gravitino/blob/dd38a05da8b7ddf90d2460dd4069c055aede9bfa/catalogs/catalog-glue/src/main/java/org/apache/gravitino/catalog/glue/GlueIcebergTableHelper.java)|39.39%|:red_circle:|
   
   </details>


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org