You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "nastra (via GitHub)" <gi...@apache.org> on 2025/07/01 06:41:00 UTC

Re: [PR] Spark: Registering tables to nonexistent target namespace leads to metadata deletion in HiveCatalog [iceberg]

nastra commented on code in PR #13434:
URL: https://github.com/apache/iceberg/pull/13434#discussion_r2176556165


##########
spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/procedures/RegisterTableProcedure.java:
##########
@@ -86,6 +87,12 @@ public InternalRow[] call(InternalRow args) {
         "Cannot handle an empty argument metadata_file");
 
     Catalog icebergCatalog = ((HasIcebergCatalog) tableCatalog()).icebergCatalog();
+    if (tableName.hasNamespace() && icebergCatalog instanceof SupportsNamespaces) {

Review Comment:
   I don't think this check should be part of the procedure. Instead, such a check should be added in `registerTable()` in `BaseMetastoreCatalog` / `RestSessionCatalog`. Tests can then be added to `CatalogTests` for `RestSessionCatalog`.  Tests for registerTable in `BaseMetastoreCatalog` are spread across different catalog implementations, so tests should be added there as well



-- 
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: issues-unsubscribe@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org