This is an automated email from the ASF dual-hosted git repository.

yufei pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/polaris.git


The following commit(s) were added to refs/heads/main by this push:
     new f061f2ec9b Service: Delete duplicated isCreate method (#3887)
f061f2ec9b is described below

commit f061f2ec9b2ab493bb752d6fa20b327ac45c5ecd
Author: Nándor Kollár <[email protected]>
AuthorDate: Thu Feb 26 18:14:48 2026 +0100

    Service: Delete duplicated isCreate method (#3887)
---
 .../catalog/iceberg/CatalogHandlerUtils.java       |  2 +-
 .../catalog/iceberg/IcebergCatalogAdapter.java     |  2 +-
 .../catalog/iceberg/IcebergCatalogHandler.java     | 26 ++--------------------
 3 files changed, 4 insertions(+), 26 deletions(-)

diff --git 
a/runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/CatalogHandlerUtils.java
 
b/runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/CatalogHandlerUtils.java
index d41bf2e384..68a9198161 100644
--- 
a/runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/CatalogHandlerUtils.java
+++ 
b/runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/CatalogHandlerUtils.java
@@ -367,7 +367,7 @@ public class CatalogHandlerUtils {
     catalog.renameTable(request.source(), request.destination());
   }
 
-  private boolean isCreate(UpdateTableRequest request) {
+  static boolean isCreate(UpdateTableRequest request) {
     boolean isCreate =
         request.requirements().stream()
             
.anyMatch(UpdateRequirement.AssertTableDoesNotExist.class::isInstance);
diff --git 
a/runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogAdapter.java
 
b/runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogAdapter.java
index 930fac1845..43c08751fe 100644
--- 
a/runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogAdapter.java
+++ 
b/runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogAdapter.java
@@ -459,7 +459,7 @@ public class IcebergCatalogAdapter
         securityContext,
         prefix,
         catalog -> {
-          if (IcebergCatalogHandler.isCreate(revisedRequest)) {
+          if (CatalogHandlerUtils.isCreate(revisedRequest)) {
             return 
Response.ok(catalog.updateTableForStagedCreate(tableIdentifier, revisedRequest))
                 .build();
           } else {
diff --git 
a/runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java
 
b/runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java
index 0c5b0502c9..fedc3bb943 100644
--- 
a/runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java
+++ 
b/runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java
@@ -225,27 +225,6 @@ public abstract class IcebergCatalogHandler extends 
CatalogHandler implements Au
     return catalogEntity;
   }
 
-  /**
-   * TODO: Make the helper in org.apache.iceberg.rest.CatalogHandlers public 
instead of needing to
-   * copy/paste here.
-   */
-  public static boolean isCreate(UpdateTableRequest request) {
-    boolean isCreate =
-        request.requirements().stream()
-            
.anyMatch(UpdateRequirement.AssertTableDoesNotExist.class::isInstance);
-
-    if (isCreate) {
-      List<UpdateRequirement> invalidRequirements =
-          request.requirements().stream()
-              .filter(req -> !(req instanceof 
UpdateRequirement.AssertTableDoesNotExist))
-              .collect(Collectors.toList());
-      Preconditions.checkArgument(
-          invalidRequirements.isEmpty(), "Invalid create requirements: %s", 
invalidRequirements);
-    }
-
-    return isCreate;
-  }
-
   private boolean shouldDecodeToken() {
     return realmConfig().getConfig(LIST_PAGINATION_ENABLED, 
getResolvedCatalogEntity());
   }
@@ -1063,7 +1042,7 @@ public abstract class IcebergCatalogHandler extends 
CatalogHandler implements Au
                 throw new IllegalStateException(
                     "Cannot wrap catalog that does not produce BaseTable");
               }
-              if (isCreate(change)) {
+              if (CatalogHandlerUtils.isCreate(change)) {
                 throw new BadRequestException(
                     "Unsupported operation: commitTranaction with 
updateForStagedCreate: %s",
                     change);
@@ -1092,8 +1071,7 @@ public abstract class IcebergCatalogHandler extends 
CatalogHandler implements Au
                             throw new BadRequestException(
                                 "Unsupported operation: commitTransaction 
containing SetLocation"
                                     + " for table '%s' and new location '%s'",
-                                change.identifier(),
-                                ((MetadataUpdate.SetLocation) 
singleUpdate).location());
+                                change.identifier(), setLocation.location());
                           }
                         }
 

Reply via email to