22
22
import static java .util .Objects .requireNonNull ;
23
23
import static org .apache .polaris .core .entity .CatalogEntity .CATALOG_TYPE_PROPERTY ;
24
24
import static org .apache .polaris .core .entity .CatalogEntity .DEFAULT_BASE_LOCATION_KEY ;
25
- import static org .apache .polaris .core .entity .IcebergTableLikeEntity .METADATA_LOCATION_KEY ;
26
25
import static org .apache .polaris .core .entity .PolarisEntityConstants .PRINCIPAL_CREDENTIAL_ROTATION_REQUIRED_STATE ;
26
+ import static org .apache .polaris .core .entity .PolarisEntitySubType .ICEBERG_TABLE ;
27
+ import static org .apache .polaris .core .entity .PolarisEntitySubType .ICEBERG_VIEW ;
28
+ import static org .apache .polaris .core .entity .table .IcebergTableLikeEntity .METADATA_LOCATION_KEY ;
27
29
import static org .apache .polaris .persistence .coretypes .refs .References .catalogReferenceNames ;
28
30
import static org .apache .polaris .persistence .coretypes .refs .References .perCatalogReferenceName ;
29
31
import static org .apache .polaris .persistence .coretypes .refs .References .realmReferenceNames ;
@@ -228,12 +230,12 @@ static <O extends ObjBase, B extends ObjBase.Builder<O, B>> B mapToObj(
228
230
Optional .ofNullable (properties .remove ("data" ))
229
231
.map (TypeMapping ::serializeStringCompressed ));
230
232
}
231
- case ICEBERG_TABLE_LIKE -> {
233
+ case TABLE_LIKE -> {
232
234
var tlBuilder = (IcebergTableLikeObj .Builder <?, ?>) null ;
233
235
tlBuilder =
234
236
switch (subType ) {
235
- case TABLE -> IcebergTableObj .builder ();
236
- case VIEW -> IcebergViewObj .builder ();
237
+ case ICEBERG_TABLE -> IcebergTableObj .builder ();
238
+ case ICEBERG_VIEW -> IcebergViewObj .builder ();
237
239
default ->
238
240
throw new IllegalArgumentException ("Unknown or invalid subtype " + type );
239
241
};
@@ -285,12 +287,12 @@ static <O extends ObjBase, B extends ObjBase.Builder<O, B>> B mapToObj(
285
287
286
288
static boolean isCatalogContent (int entityTypeCode ) {
287
289
return entityTypeCode == PolarisEntityType .NAMESPACE .getCode ()
288
- || entityTypeCode == PolarisEntityType .ICEBERG_TABLE_LIKE .getCode ();
290
+ || entityTypeCode == PolarisEntityType .TABLE_LIKE .getCode ();
289
291
}
290
292
291
293
static boolean isCatalogContent (PolarisEntityType entityType ) {
292
294
return switch (entityType ) {
293
- case NAMESPACE , ICEBERG_TABLE_LIKE -> true ;
295
+ case NAMESPACE , TABLE_LIKE -> true ;
294
296
default -> false ;
295
297
};
296
298
}
@@ -300,10 +302,10 @@ static Class<? extends ObjBase> objTypeForPolarisTypeForFiltering(
300
302
return switch (entityType ) {
301
303
case PRINCIPAL -> PrincipalObj .class ;
302
304
case TASK -> ImmediateTaskObj .class ;
303
- case ICEBERG_TABLE_LIKE ->
305
+ case TABLE_LIKE ->
304
306
switch (subType ) {
305
- case TABLE -> IcebergTableObj .class ;
306
- case VIEW -> IcebergViewObj .class ;
307
+ case ICEBERG_TABLE -> IcebergTableObj .class ;
308
+ case ICEBERG_VIEW -> IcebergViewObj .class ;
307
309
case ANY_SUBTYPE -> IcebergTableLikeObj .class ;
308
310
default -> throw new IllegalArgumentException ("Illegal subtype " + subType );
309
311
};
@@ -321,10 +323,10 @@ static ObjType objTypeForPolarisType(PolarisEntityType entityType, PolarisEntity
321
323
return switch (entityType ) {
322
324
case PRINCIPAL -> PrincipalObj .TYPE ;
323
325
case TASK -> ImmediateTaskObj .TYPE ;
324
- case ICEBERG_TABLE_LIKE ->
326
+ case TABLE_LIKE ->
325
327
switch (subType ) {
326
- case TABLE -> IcebergTableObj .TYPE ;
327
- case VIEW -> IcebergViewObj .TYPE ;
328
+ case ICEBERG_TABLE -> IcebergTableObj .TYPE ;
329
+ case ICEBERG_VIEW -> IcebergViewObj .TYPE ;
328
330
default -> throw new IllegalArgumentException ("Illegal subtype " + subType );
329
331
};
330
332
case NAMESPACE -> LocalNamespaceObj .TYPE ;
@@ -352,7 +354,7 @@ static Class<? extends ContainerObj> containerTypeForEntityType(
352
354
353
355
// per catalog
354
356
case CATALOG_ROLE -> CatalogRolesObj .class ;
355
- case NAMESPACE , ICEBERG_TABLE_LIKE -> CatalogStateObj .class ;
357
+ case NAMESPACE , TABLE_LIKE -> CatalogStateObj .class ;
356
358
357
359
default -> throw new IllegalArgumentException ("Unsupported entity type: " + entityType );
358
360
};
@@ -368,7 +370,7 @@ static Class<? extends ContainerObj> containerTypeForEntityType(
368
370
369
371
// per catalog
370
372
case CATALOG_ROLE -> CatalogRolesObj .builder ();
371
- case NAMESPACE , ICEBERG_TABLE_LIKE -> CatalogStateObj .builder ();
373
+ case NAMESPACE , TABLE_LIKE -> CatalogStateObj .builder ();
372
374
373
375
default -> throw new IllegalArgumentException ("Unsupported entity type: " + entityType );
374
376
};
@@ -389,13 +391,13 @@ static PolarisBaseEntity mapToEntity(@Nonnull ObjBase objBase, long catalogId) {
389
391
switch (objBase ) {
390
392
case TableLikeObj o -> {
391
393
catalogMandatory (catalogId );
392
- type = PolarisEntityType .ICEBERG_TABLE_LIKE ;
394
+ type = PolarisEntityType .TABLE_LIKE ;
393
395
o .metadataLocation ().ifPresent (v -> internalProperties .put (METADATA_LOCATION_KEY , v ));
394
396
if (objBase instanceof IcebergTableObj ) {
395
- subType = PolarisEntitySubType . TABLE ;
397
+ subType = ICEBERG_TABLE ;
396
398
}
397
399
if (objBase instanceof IcebergViewObj ) {
398
- subType = PolarisEntitySubType . VIEW ;
400
+ subType = ICEBERG_VIEW ;
399
401
}
400
402
}
401
403
case LocalNamespaceObj ignored -> {
@@ -489,12 +491,12 @@ static EntityNameLookupRecord mapToEntityNameLookupRecord(
489
491
switch (objBase ) {
490
492
case TableLikeObj ignored -> {
491
493
catalogMandatory (catalogStableId );
492
- type = PolarisEntityType .ICEBERG_TABLE_LIKE ;
494
+ type = PolarisEntityType .TABLE_LIKE ;
493
495
if (objBase instanceof IcebergTableObj ) {
494
- subType = PolarisEntitySubType . TABLE ;
496
+ subType = ICEBERG_TABLE ;
495
497
}
496
498
if (objBase instanceof IcebergViewObj ) {
497
- subType = PolarisEntitySubType . VIEW ;
499
+ subType = ICEBERG_VIEW ;
498
500
}
499
501
}
500
502
case LocalNamespaceObj ignored -> {
@@ -572,7 +574,7 @@ static String referenceName(PolarisEntityType entityType, long catalogStableId)
572
574
// per catalog
573
575
case CATALOG_ROLE ->
574
576
perCatalogReferenceName (CatalogRolesObj .CATALOG_ROLES_REF_NAME_PATTERN , catalogStableId );
575
- case NAMESPACE , ICEBERG_TABLE_LIKE ->
577
+ case NAMESPACE , TABLE_LIKE ->
576
578
perCatalogReferenceName (CatalogStateObj .CATALOG_STATE_REF_NAME_PATTERN , catalogStableId );
577
579
578
580
default -> throw new IllegalArgumentException ("Unsupported entity type: " + entityType );
@@ -599,10 +601,10 @@ static String entitySubTypeCodeFromObjType(ObjRef objRef) {
599
601
if (objRef != null ) {
600
602
var objType = ObjTypes .objTypeById (objRef .type ());
601
603
if (objType .equals (IcebergTableObj .TYPE )) {
602
- return Integer .toString (PolarisEntitySubType . TABLE .getCode ());
604
+ return Integer .toString (ICEBERG_TABLE .getCode ());
603
605
}
604
606
if (objType .equals (IcebergViewObj .TYPE )) {
605
- return Integer .toString (PolarisEntitySubType . VIEW .getCode ());
607
+ return Integer .toString (ICEBERG_VIEW .getCode ());
606
608
}
607
609
}
608
610
return null ;
0 commit comments