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

dimas 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 8ad8f74f6 Add subtype-check to PolarisEntity subclass ctors (#2492)
8ad8f74f6 is described below

commit 8ad8f74f62258ab6238190271603e4d4c8a75998
Author: Christopher Lambert <xn...@gmx.de>
AuthorDate: Thu Sep 11 21:25:53 2025 +0200

    Add subtype-check to PolarisEntity subclass ctors (#2492)
    
    this is a follow-up to ac31963c9eef12b2e1a1c7615d950939caf3b200
---
 .../apache/polaris/core/entity/CatalogEntity.java   |  4 ++++
 .../polaris/core/entity/CatalogRoleEntity.java      |  4 ++++
 .../apache/polaris/core/entity/NamespaceEntity.java |  4 ++++
 .../apache/polaris/core/entity/PrincipalEntity.java |  4 ++++
 .../polaris/core/entity/PrincipalRoleEntity.java    |  4 ++++
 .../org/apache/polaris/core/entity/TaskEntity.java  |  4 ++++
 .../core/entity/table/GenericTableEntity.java       |  5 +++++
 .../core/entity/table/IcebergTableLikeEntity.java   | 12 +++++++++++-
 .../apache/polaris/core/policy/PolicyEntity.java    |  5 +++++
 .../core/persistence/cache/EntityWeigherTest.java   |  5 ++++-
 .../persistence/cache/InMemoryEntityCacheTest.java  | 11 ++++++++---
 .../polaris/core/policy/PolicyValidatorsTest.java   |  4 ++--
 .../catalog/generic/PolarisGenericTableCatalog.java |  4 +---
 .../service/catalog/iceberg/IcebergCatalog.java     | 21 +++++++++++++--------
 .../service/task/TableCleanupTaskHandlerTest.java   | 16 +++++++++++-----
 15 files changed, 84 insertions(+), 23 deletions(-)

diff --git 
a/polaris-core/src/main/java/org/apache/polaris/core/entity/CatalogEntity.java 
b/polaris-core/src/main/java/org/apache/polaris/core/entity/CatalogEntity.java
index 5b40de18f..44f261c4c 100644
--- 
a/polaris-core/src/main/java/org/apache/polaris/core/entity/CatalogEntity.java
+++ 
b/polaris-core/src/main/java/org/apache/polaris/core/entity/CatalogEntity.java
@@ -80,6 +80,10 @@ public class CatalogEntity extends PolarisEntity implements 
LocationBasedEntity
     super(sourceEntity);
     Preconditions.checkState(
         getType() == PolarisEntityType.CATALOG, "Invalid entity type: %s", 
getType());
+    Preconditions.checkState(
+        getSubType() == PolarisEntitySubType.NULL_SUBTYPE,
+        "Invalid entity sub type: %s",
+        getSubType());
   }
 
   public static @Nullable CatalogEntity of(@Nullable PolarisBaseEntity 
sourceEntity) {
diff --git 
a/polaris-core/src/main/java/org/apache/polaris/core/entity/CatalogRoleEntity.java
 
b/polaris-core/src/main/java/org/apache/polaris/core/entity/CatalogRoleEntity.java
index fa36e6022..4891e5fef 100644
--- 
a/polaris-core/src/main/java/org/apache/polaris/core/entity/CatalogRoleEntity.java
+++ 
b/polaris-core/src/main/java/org/apache/polaris/core/entity/CatalogRoleEntity.java
@@ -28,6 +28,10 @@ public class CatalogRoleEntity extends PolarisEntity {
     super(sourceEntity);
     Preconditions.checkState(
         getType() == PolarisEntityType.CATALOG_ROLE, "Invalid entity type: 
%s", getType());
+    Preconditions.checkState(
+        getSubType() == PolarisEntitySubType.NULL_SUBTYPE,
+        "Invalid entity sub type: %s",
+        getSubType());
   }
 
   public static @Nullable CatalogRoleEntity of(@Nullable PolarisBaseEntity 
sourceEntity) {
diff --git 
a/polaris-core/src/main/java/org/apache/polaris/core/entity/NamespaceEntity.java
 
b/polaris-core/src/main/java/org/apache/polaris/core/entity/NamespaceEntity.java
index 49d7c7ae9..e6e3276e5 100644
--- 
a/polaris-core/src/main/java/org/apache/polaris/core/entity/NamespaceEntity.java
+++ 
b/polaris-core/src/main/java/org/apache/polaris/core/entity/NamespaceEntity.java
@@ -37,6 +37,10 @@ public class NamespaceEntity extends PolarisEntity 
implements LocationBasedEntit
     super(sourceEntity);
     Preconditions.checkState(
         getType() == PolarisEntityType.NAMESPACE, "Invalid entity type: %s", 
getType());
+    Preconditions.checkState(
+        getSubType() == PolarisEntitySubType.NULL_SUBTYPE,
+        "Invalid entity sub type: %s",
+        getSubType());
   }
 
   public static @Nullable NamespaceEntity of(@Nullable PolarisBaseEntity 
sourceEntity) {
diff --git 
a/polaris-core/src/main/java/org/apache/polaris/core/entity/PrincipalEntity.java
 
b/polaris-core/src/main/java/org/apache/polaris/core/entity/PrincipalEntity.java
index 250b27da0..1e652bba0 100644
--- 
a/polaris-core/src/main/java/org/apache/polaris/core/entity/PrincipalEntity.java
+++ 
b/polaris-core/src/main/java/org/apache/polaris/core/entity/PrincipalEntity.java
@@ -28,6 +28,10 @@ public class PrincipalEntity extends PolarisEntity {
     super(sourceEntity);
     Preconditions.checkState(
         getType() == PolarisEntityType.PRINCIPAL, "Invalid entity type: %s", 
getType());
+    Preconditions.checkState(
+        getSubType() == PolarisEntitySubType.NULL_SUBTYPE,
+        "Invalid entity sub type: %s",
+        getSubType());
   }
 
   public static @Nullable PrincipalEntity of(@Nullable PolarisBaseEntity 
sourceEntity) {
diff --git 
a/polaris-core/src/main/java/org/apache/polaris/core/entity/PrincipalRoleEntity.java
 
b/polaris-core/src/main/java/org/apache/polaris/core/entity/PrincipalRoleEntity.java
index 398a77dc9..fb3e14a6a 100644
--- 
a/polaris-core/src/main/java/org/apache/polaris/core/entity/PrincipalRoleEntity.java
+++ 
b/polaris-core/src/main/java/org/apache/polaris/core/entity/PrincipalRoleEntity.java
@@ -31,6 +31,10 @@ public class PrincipalRoleEntity extends PolarisEntity {
     super(sourceEntity);
     Preconditions.checkState(
         getType() == PolarisEntityType.PRINCIPAL_ROLE, "Invalid entity type: 
%s", getType());
+    Preconditions.checkState(
+        getSubType() == PolarisEntitySubType.NULL_SUBTYPE,
+        "Invalid entity sub type: %s",
+        getSubType());
   }
 
   public static @Nullable PrincipalRoleEntity of(@Nullable PolarisBaseEntity 
sourceEntity) {
diff --git 
a/polaris-core/src/main/java/org/apache/polaris/core/entity/TaskEntity.java 
b/polaris-core/src/main/java/org/apache/polaris/core/entity/TaskEntity.java
index 40bead37e..c8a217ee1 100644
--- a/polaris-core/src/main/java/org/apache/polaris/core/entity/TaskEntity.java
+++ b/polaris-core/src/main/java/org/apache/polaris/core/entity/TaskEntity.java
@@ -31,6 +31,10 @@ public class TaskEntity extends PolarisEntity {
     super(sourceEntity);
     Preconditions.checkState(
         getType() == PolarisEntityType.TASK, "Invalid entity type: %s", 
getType());
+    Preconditions.checkState(
+        getSubType() == PolarisEntitySubType.NULL_SUBTYPE,
+        "Invalid entity sub type: %s",
+        getSubType());
   }
 
   public static @Nullable TaskEntity of(@Nullable PolarisBaseEntity 
sourceEntity) {
diff --git 
a/polaris-core/src/main/java/org/apache/polaris/core/entity/table/GenericTableEntity.java
 
b/polaris-core/src/main/java/org/apache/polaris/core/entity/table/GenericTableEntity.java
index c08f5f3ab..412455835 100644
--- 
a/polaris-core/src/main/java/org/apache/polaris/core/entity/table/GenericTableEntity.java
+++ 
b/polaris-core/src/main/java/org/apache/polaris/core/entity/table/GenericTableEntity.java
@@ -19,6 +19,7 @@
 package org.apache.polaris.core.entity.table;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.google.common.base.Preconditions;
 import jakarta.annotation.Nullable;
 import org.apache.iceberg.catalog.Namespace;
 import org.apache.iceberg.catalog.TableIdentifier;
@@ -41,6 +42,10 @@ public class GenericTableEntity extends TableLikeEntity {
 
   public GenericTableEntity(PolarisBaseEntity sourceEntity) {
     super(sourceEntity);
+    Preconditions.checkState(
+        getSubType() == PolarisEntitySubType.GENERIC_TABLE,
+        "Invalid entity sub type: %s",
+        getSubType());
   }
 
   public static @Nullable GenericTableEntity of(@Nullable PolarisBaseEntity 
sourceEntity) {
diff --git 
a/polaris-core/src/main/java/org/apache/polaris/core/entity/table/IcebergTableLikeEntity.java
 
b/polaris-core/src/main/java/org/apache/polaris/core/entity/table/IcebergTableLikeEntity.java
index b4673180f..ea7af6363 100644
--- 
a/polaris-core/src/main/java/org/apache/polaris/core/entity/table/IcebergTableLikeEntity.java
+++ 
b/polaris-core/src/main/java/org/apache/polaris/core/entity/table/IcebergTableLikeEntity.java
@@ -19,6 +19,7 @@
 package org.apache.polaris.core.entity.table;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.google.common.base.Preconditions;
 import jakarta.annotation.Nullable;
 import java.util.Optional;
 import org.apache.iceberg.catalog.Namespace;
@@ -28,6 +29,7 @@ import org.apache.polaris.core.entity.NamespaceEntity;
 import org.apache.polaris.core.entity.PolarisBaseEntity;
 import org.apache.polaris.core.entity.PolarisEntity;
 import org.apache.polaris.core.entity.PolarisEntityConstants;
+import org.apache.polaris.core.entity.PolarisEntitySubType;
 import org.apache.polaris.core.entity.PolarisEntityType;
 
 /**
@@ -47,6 +49,12 @@ public class IcebergTableLikeEntity extends TableLikeEntity {
 
   public IcebergTableLikeEntity(PolarisBaseEntity sourceEntity) {
     super(sourceEntity);
+    PolarisEntitySubType subType = getSubType();
+    Preconditions.checkState(
+        subType == PolarisEntitySubType.ICEBERG_TABLE
+            || subType == PolarisEntitySubType.ICEBERG_VIEW,
+        "Invalid entity sub type: %s",
+        subType);
   }
 
   public static @Nullable IcebergTableLikeEntity of(@Nullable 
PolarisBaseEntity sourceEntity) {
@@ -75,9 +83,11 @@ public class IcebergTableLikeEntity extends TableLikeEntity {
   }
 
   public static class Builder extends 
PolarisEntity.BaseBuilder<IcebergTableLikeEntity, Builder> {
-    public Builder(TableIdentifier identifier, String metadataLocation) {
+    public Builder(
+        PolarisEntitySubType subType, TableIdentifier identifier, String 
metadataLocation) {
       super();
       setType(PolarisEntityType.TABLE_LIKE);
+      setSubType(subType);
       setTableIdentifier(identifier);
       setMetadataLocation(metadataLocation);
     }
diff --git 
a/polaris-core/src/main/java/org/apache/polaris/core/policy/PolicyEntity.java 
b/polaris-core/src/main/java/org/apache/polaris/core/policy/PolicyEntity.java
index b10b09c7d..8898759cd 100644
--- 
a/polaris-core/src/main/java/org/apache/polaris/core/policy/PolicyEntity.java
+++ 
b/polaris-core/src/main/java/org/apache/polaris/core/policy/PolicyEntity.java
@@ -26,6 +26,7 @@ import org.apache.iceberg.rest.RESTUtil;
 import org.apache.polaris.core.entity.NamespaceEntity;
 import org.apache.polaris.core.entity.PolarisBaseEntity;
 import org.apache.polaris.core.entity.PolarisEntity;
+import org.apache.polaris.core.entity.PolarisEntitySubType;
 import org.apache.polaris.core.entity.PolarisEntityType;
 
 public class PolicyEntity extends PolarisEntity {
@@ -39,6 +40,10 @@ public class PolicyEntity extends PolarisEntity {
     super(sourceEntity);
     Preconditions.checkState(
         getType() == PolarisEntityType.POLICY, "Invalid entity type: %s", 
getType());
+    Preconditions.checkState(
+        getSubType() == PolarisEntitySubType.NULL_SUBTYPE,
+        "Invalid entity sub type: %s",
+        getSubType());
   }
 
   public static @Nullable PolicyEntity of(@Nullable PolarisBaseEntity 
sourceEntity) {
diff --git 
a/polaris-core/src/test/java/org/apache/polaris/core/persistence/cache/EntityWeigherTest.java
 
b/polaris-core/src/test/java/org/apache/polaris/core/persistence/cache/EntityWeigherTest.java
index 16039e540..109a52172 100644
--- 
a/polaris-core/src/test/java/org/apache/polaris/core/persistence/cache/EntityWeigherTest.java
+++ 
b/polaris-core/src/test/java/org/apache/polaris/core/persistence/cache/EntityWeigherTest.java
@@ -29,6 +29,7 @@ import java.util.Optional;
 import org.apache.iceberg.catalog.TableIdentifier;
 import org.apache.polaris.core.PolarisDefaultDiagServiceImpl;
 import org.apache.polaris.core.PolarisDiagnostics;
+import org.apache.polaris.core.entity.PolarisEntitySubType;
 import org.apache.polaris.core.entity.table.IcebergTableLikeEntity;
 import org.apache.polaris.core.persistence.ResolvedPolarisEntity;
 import org.assertj.core.api.Assertions;
@@ -48,7 +49,9 @@ public class EntityWeigherTest {
       String properties,
       Optional<String> internalProperties) {
     Map<String, String> propertiesMap = getPropertiesMap(properties);
-    var entity = new IcebergTableLikeEntity.Builder(TableIdentifier.of(name), 
metadataLocation);
+    var entity =
+        new IcebergTableLikeEntity.Builder(
+            PolarisEntitySubType.ICEBERG_TABLE, TableIdentifier.of(name), 
metadataLocation);
     entity.setProperties(propertiesMap);
     internalProperties.ifPresent(
         p -> {
diff --git 
a/polaris-core/src/test/java/org/apache/polaris/core/persistence/cache/InMemoryEntityCacheTest.java
 
b/polaris-core/src/test/java/org/apache/polaris/core/persistence/cache/InMemoryEntityCacheTest.java
index d750c4821..ce3432050 100644
--- 
a/polaris-core/src/test/java/org/apache/polaris/core/persistence/cache/InMemoryEntityCacheTest.java
+++ 
b/polaris-core/src/test/java/org/apache/polaris/core/persistence/cache/InMemoryEntityCacheTest.java
@@ -480,13 +480,18 @@ public class InMemoryEntityCacheTest {
 
   @Test
   void testEntityWeigher() {
-    var smallEntity = new 
IcebergTableLikeEntity.Builder(TableIdentifier.of("ns.t1"), "").build();
+    var smallEntity =
+        new IcebergTableLikeEntity.Builder(
+                PolarisEntitySubType.ICEBERG_TABLE, 
TableIdentifier.of("ns.t1"), "")
+            .build();
     var mediumEntity =
-        new IcebergTableLikeEntity.Builder(TableIdentifier.of("ns.t1"), "")
+        new IcebergTableLikeEntity.Builder(
+                PolarisEntitySubType.ICEBERG_TABLE, 
TableIdentifier.of("ns.t1"), "")
             .setMetadataLocation("a".repeat(10000))
             .build();
     var largeEntity =
-        new IcebergTableLikeEntity.Builder(TableIdentifier.of("ns.t1"), "")
+        new IcebergTableLikeEntity.Builder(
+                PolarisEntitySubType.ICEBERG_TABLE, 
TableIdentifier.of("ns.t1"), "")
             .setMetadataLocation("a".repeat(1000 * 1000))
             .build();
 
diff --git 
a/polaris-core/src/test/java/org/apache/polaris/core/policy/PolicyValidatorsTest.java
 
b/polaris-core/src/test/java/org/apache/polaris/core/policy/PolicyValidatorsTest.java
index 04435ba73..723e3bbc4 100644
--- 
a/polaris-core/src/test/java/org/apache/polaris/core/policy/PolicyValidatorsTest.java
+++ 
b/polaris-core/src/test/java/org/apache/polaris/core/policy/PolicyValidatorsTest.java
@@ -106,7 +106,7 @@ public class PolicyValidatorsTest {
   @Test
   public void testCanAttachReturnsTrueForIcebergTableLikeWithTableSubtype() {
     var targetEntity =
-        new IcebergTableLikeEntity.Builder(tableIdentifier, 
"").setSubType(ICEBERG_TABLE).build();
+        new IcebergTableLikeEntity.Builder(ICEBERG_TABLE, tableIdentifier, 
"").build();
     var result = PolicyValidators.canAttach(policyEntity, targetEntity);
     assertThat(result)
         .isTrue()
@@ -116,7 +116,7 @@ public class PolicyValidatorsTest {
   @Test
   public void 
testCanAttachReturnsFalseForIcebergTableLikeWithNonTableSubtype() {
     var targetEntity =
-        new IcebergTableLikeEntity.Builder(tableIdentifier, 
"").setSubType(ICEBERG_VIEW).build();
+        new IcebergTableLikeEntity.Builder(ICEBERG_VIEW, tableIdentifier, 
"").build();
     var result = PolicyValidators.canAttach(policyEntity, targetEntity);
     assertThat(result)
         .isFalse()
diff --git 
a/runtime/service/src/main/java/org/apache/polaris/service/catalog/generic/PolarisGenericTableCatalog.java
 
b/runtime/service/src/main/java/org/apache/polaris/service/catalog/generic/PolarisGenericTableCatalog.java
index 293b73c1d..918ef563a 100644
--- 
a/runtime/service/src/main/java/org/apache/polaris/service/catalog/generic/PolarisGenericTableCatalog.java
+++ 
b/runtime/service/src/main/java/org/apache/polaris/service/catalog/generic/PolarisGenericTableCatalog.java
@@ -95,9 +95,7 @@ public class PolarisGenericTableCatalog implements 
GenericTableCatalog {
     PolarisResolvedPathWrapper resolvedEntities =
         resolvedEntityView.getPassthroughResolvedPath(
             tableIdentifier, PolarisEntityType.TABLE_LIKE, 
PolarisEntitySubType.ANY_SUBTYPE);
-    GenericTableEntity entity =
-        GenericTableEntity.of(
-            resolvedEntities == null ? null : 
resolvedEntities.getRawLeafEntity());
+    PolarisEntity entity = resolvedEntities == null ? null : 
resolvedEntities.getRawLeafEntity();
     if (null == entity) {
       entity =
           new GenericTableEntity.Builder(tableIdentifier, format)
diff --git 
a/runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java
 
b/runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java
index 01ad489d8..d7dc69b26 100644
--- 
a/runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java
+++ 
b/runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java
@@ -103,6 +103,7 @@ import 
org.apache.polaris.core.entity.PolarisEntityConstants;
 import org.apache.polaris.core.entity.PolarisEntitySubType;
 import org.apache.polaris.core.entity.PolarisEntityType;
 import org.apache.polaris.core.entity.PolarisTaskConstants;
+import org.apache.polaris.core.entity.table.GenericTableEntity;
 import org.apache.polaris.core.entity.table.IcebergTableLikeEntity;
 import org.apache.polaris.core.exceptions.CommitConflictException;
 import org.apache.polaris.core.persistence.PolarisMetaStoreManager;
@@ -1060,6 +1061,7 @@ public class IcebergCatalog extends 
BaseMetastoreViewCatalog
           IcebergTableLikeEntity.of(
               new PolarisEntity.Builder()
                   .setType(PolarisEntityType.TABLE_LIKE)
+                  .setSubType(PolarisEntitySubType.ICEBERG_TABLE)
                   .setParentId(resolvedNamespace.getLast().getId())
                   
.setProperties(Map.of(PolarisEntityConstants.ENTITY_BASE_LOCATION, location))
                   .build());
@@ -1262,8 +1264,11 @@ public class IcebergCatalog extends 
BaseMetastoreViewCatalog
                     tbl -> {
                       PolarisResolvedPathWrapper resolveTablePath =
                           resolutionManifest.getResolvedPath(tbl);
-                      return 
IcebergTableLikeEntity.of(resolveTablePath.getRawLeafEntity())
-                          .getBaseLocation();
+                      PolarisEntity tableEntity = 
resolveTablePath.getRawLeafEntity();
+                      if (tableEntity.getSubType() == 
PolarisEntitySubType.GENERIC_TABLE) {
+                        return 
GenericTableEntity.of(tableEntity).getBaseLocation();
+                      }
+                      return 
IcebergTableLikeEntity.of(tableEntity).getBaseLocation();
                     }),
             siblingNamespaces.stream()
                 .filter(ns -> !ns.level(ns.length() - 1).equals(name))
@@ -1567,9 +1572,9 @@ public class IcebergCatalog extends 
BaseMetastoreViewCatalog
       if (null == entity) {
         existingLocation = null;
         entity =
-            new IcebergTableLikeEntity.Builder(tableIdentifier, newLocation)
+            new IcebergTableLikeEntity.Builder(
+                    PolarisEntitySubType.ICEBERG_TABLE, tableIdentifier, 
newLocation)
                 .setCatalogId(getCatalogId())
-                .setSubType(PolarisEntitySubType.ICEBERG_TABLE)
                 .setBaseLocation(metadata.location())
                 .setId(
                     
getMetaStoreManager().generateNewEntityId(getCurrentPolarisContext()).getId())
@@ -1904,9 +1909,9 @@ public class IcebergCatalog extends 
BaseMetastoreViewCatalog
       if (null == entity) {
         existingLocation = null;
         entity =
-            new IcebergTableLikeEntity.Builder(identifier, newLocation)
+            new IcebergTableLikeEntity.Builder(
+                    PolarisEntitySubType.ICEBERG_VIEW, identifier, newLocation)
                 .setCatalogId(getCatalogId())
-                .setSubType(PolarisEntitySubType.ICEBERG_VIEW)
                 .setId(
                     
getMetaStoreManager().generateNewEntityId(getCurrentPolarisContext()).getId())
                 .build();
@@ -2503,9 +2508,9 @@ public class IcebergCatalog extends 
BaseMetastoreViewCatalog
       if (null == entity) {
         existingLocation = null;
         entity =
-            new IcebergTableLikeEntity.Builder(tableIdentifier, newLocation)
+            new IcebergTableLikeEntity.Builder(
+                    PolarisEntitySubType.ICEBERG_TABLE, tableIdentifier, 
newLocation)
                 .setCatalogId(getCatalogId())
-                .setSubType(PolarisEntitySubType.ICEBERG_TABLE)
                 .setId(
                     
getMetaStoreManager().generateNewEntityId(getCurrentPolarisContext()).getId())
                 
.setLastNotificationTimestamp(request.getPayload().getTimestamp())
diff --git 
a/runtime/service/src/test/java/org/apache/polaris/service/task/TableCleanupTaskHandlerTest.java
 
b/runtime/service/src/test/java/org/apache/polaris/service/task/TableCleanupTaskHandlerTest.java
index bcccff266..7ddaee77e 100644
--- 
a/runtime/service/src/test/java/org/apache/polaris/service/task/TableCleanupTaskHandlerTest.java
+++ 
b/runtime/service/src/test/java/org/apache/polaris/service/task/TableCleanupTaskHandlerTest.java
@@ -43,6 +43,7 @@ import org.apache.polaris.core.context.CallContext;
 import org.apache.polaris.core.context.RealmContext;
 import org.apache.polaris.core.entity.AsyncTaskType;
 import org.apache.polaris.core.entity.PolarisBaseEntity;
+import org.apache.polaris.core.entity.PolarisEntitySubType;
 import org.apache.polaris.core.entity.PolarisEntityType;
 import org.apache.polaris.core.entity.TaskEntity;
 import org.apache.polaris.core.entity.table.IcebergTableLikeEntity;
@@ -107,7 +108,8 @@ class TableCleanupTaskHandlerTest {
             .setName("cleanup_" + tableIdentifier)
             .withTaskType(AsyncTaskType.ENTITY_CLEANUP_SCHEDULER)
             .withData(
-                new IcebergTableLikeEntity.Builder(tableIdentifier, 
metadataFile)
+                new IcebergTableLikeEntity.Builder(
+                        PolarisEntitySubType.ICEBERG_TABLE, tableIdentifier, 
metadataFile)
                     .setName("table1")
                     .setCatalogId(1)
                     .setCreateTimestamp(100)
@@ -171,7 +173,8 @@ class TableCleanupTaskHandlerTest {
     TaskTestUtils.writeTableMetadata(fileIO, metadataFile, snapshot);
 
     IcebergTableLikeEntity icebergTableLikeEntity =
-        new IcebergTableLikeEntity.Builder(tableIdentifier, metadataFile)
+        new IcebergTableLikeEntity.Builder(
+                PolarisEntitySubType.ICEBERG_TABLE, tableIdentifier, 
metadataFile)
             .setName("table1")
             .setCatalogId(1)
             .setCreateTimestamp(100)
@@ -233,7 +236,8 @@ class TableCleanupTaskHandlerTest {
             .setName("cleanup_" + tableIdentifier)
             .withTaskType(AsyncTaskType.ENTITY_CLEANUP_SCHEDULER)
             .withData(
-                new IcebergTableLikeEntity.Builder(tableIdentifier, 
metadataFile)
+                new IcebergTableLikeEntity.Builder(
+                        PolarisEntitySubType.ICEBERG_TABLE, tableIdentifier, 
metadataFile)
                     .setName("table1")
                     .setCatalogId(1)
                     .setCreateTimestamp(100)
@@ -350,7 +354,8 @@ class TableCleanupTaskHandlerTest {
             .setName("cleanup_" + tableIdentifier)
             .withTaskType(AsyncTaskType.ENTITY_CLEANUP_SCHEDULER)
             .withData(
-                new IcebergTableLikeEntity.Builder(tableIdentifier, 
metadataFile)
+                new IcebergTableLikeEntity.Builder(
+                        PolarisEntitySubType.ICEBERG_TABLE, tableIdentifier, 
metadataFile)
                     .setName("table1")
                     .setCatalogId(1)
                     .setCreateTimestamp(100)
@@ -516,7 +521,8 @@ class TableCleanupTaskHandlerTest {
             .setName("cleanup_" + tableIdentifier)
             .withTaskType(AsyncTaskType.ENTITY_CLEANUP_SCHEDULER)
             .withData(
-                new IcebergTableLikeEntity.Builder(tableIdentifier, 
secondMetadataFile)
+                new IcebergTableLikeEntity.Builder(
+                        PolarisEntitySubType.ICEBERG_TABLE, tableIdentifier, 
secondMetadataFile)
                     .setName("table1")
                     .setCatalogId(1)
                     .setCreateTimestamp(100)

Reply via email to