Skip to content

Commit b332065

Browse files
committed
NoSQL: adapt to changes on main
1 parent 26786db commit b332065

File tree

2 files changed

+26
-24
lines changed

2 files changed

+26
-24
lines changed

components/persistence/bridge/src/main/java/org/apache/polaris/persistence/bridge/IndexedContainerAccess.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ static <C extends ContainerObj> IndexedContainerAccess<C> indexedAccessForEntity
108108
yield new IndexedContainerAccessImpl<>(
109109
persistence, refName, CatalogRolesObj.class, catalogStableId);
110110
}
111-
case NAMESPACE, ICEBERG_TABLE_LIKE -> {
111+
case NAMESPACE, TABLE_LIKE -> {
112112
catalogMandatory(catalogStableId);
113113
yield new IndexedContainerAccessImpl<>(
114114
persistence, refName, CatalogStateObj.class, catalogStableId);

components/persistence/bridge/src/main/java/org/apache/polaris/persistence/bridge/TypeMapping.java

+25-23
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222
import static java.util.Objects.requireNonNull;
2323
import static org.apache.polaris.core.entity.CatalogEntity.CATALOG_TYPE_PROPERTY;
2424
import static org.apache.polaris.core.entity.CatalogEntity.DEFAULT_BASE_LOCATION_KEY;
25-
import static org.apache.polaris.core.entity.IcebergTableLikeEntity.METADATA_LOCATION_KEY;
2625
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;
2729
import static org.apache.polaris.persistence.coretypes.refs.References.catalogReferenceNames;
2830
import static org.apache.polaris.persistence.coretypes.refs.References.perCatalogReferenceName;
2931
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(
228230
Optional.ofNullable(properties.remove("data"))
229231
.map(TypeMapping::serializeStringCompressed));
230232
}
231-
case ICEBERG_TABLE_LIKE -> {
233+
case TABLE_LIKE -> {
232234
var tlBuilder = (IcebergTableLikeObj.Builder<?, ?>) null;
233235
tlBuilder =
234236
switch (subType) {
235-
case TABLE -> IcebergTableObj.builder();
236-
case VIEW -> IcebergViewObj.builder();
237+
case ICEBERG_TABLE -> IcebergTableObj.builder();
238+
case ICEBERG_VIEW -> IcebergViewObj.builder();
237239
default ->
238240
throw new IllegalArgumentException("Unknown or invalid subtype " + type);
239241
};
@@ -285,12 +287,12 @@ static <O extends ObjBase, B extends ObjBase.Builder<O, B>> B mapToObj(
285287

286288
static boolean isCatalogContent(int entityTypeCode) {
287289
return entityTypeCode == PolarisEntityType.NAMESPACE.getCode()
288-
|| entityTypeCode == PolarisEntityType.ICEBERG_TABLE_LIKE.getCode();
290+
|| entityTypeCode == PolarisEntityType.TABLE_LIKE.getCode();
289291
}
290292

291293
static boolean isCatalogContent(PolarisEntityType entityType) {
292294
return switch (entityType) {
293-
case NAMESPACE, ICEBERG_TABLE_LIKE -> true;
295+
case NAMESPACE, TABLE_LIKE -> true;
294296
default -> false;
295297
};
296298
}
@@ -300,10 +302,10 @@ static Class<? extends ObjBase> objTypeForPolarisTypeForFiltering(
300302
return switch (entityType) {
301303
case PRINCIPAL -> PrincipalObj.class;
302304
case TASK -> ImmediateTaskObj.class;
303-
case ICEBERG_TABLE_LIKE ->
305+
case TABLE_LIKE ->
304306
switch (subType) {
305-
case TABLE -> IcebergTableObj.class;
306-
case VIEW -> IcebergViewObj.class;
307+
case ICEBERG_TABLE -> IcebergTableObj.class;
308+
case ICEBERG_VIEW -> IcebergViewObj.class;
307309
case ANY_SUBTYPE -> IcebergTableLikeObj.class;
308310
default -> throw new IllegalArgumentException("Illegal subtype " + subType);
309311
};
@@ -321,10 +323,10 @@ static ObjType objTypeForPolarisType(PolarisEntityType entityType, PolarisEntity
321323
return switch (entityType) {
322324
case PRINCIPAL -> PrincipalObj.TYPE;
323325
case TASK -> ImmediateTaskObj.TYPE;
324-
case ICEBERG_TABLE_LIKE ->
326+
case TABLE_LIKE ->
325327
switch (subType) {
326-
case TABLE -> IcebergTableObj.TYPE;
327-
case VIEW -> IcebergViewObj.TYPE;
328+
case ICEBERG_TABLE -> IcebergTableObj.TYPE;
329+
case ICEBERG_VIEW -> IcebergViewObj.TYPE;
328330
default -> throw new IllegalArgumentException("Illegal subtype " + subType);
329331
};
330332
case NAMESPACE -> LocalNamespaceObj.TYPE;
@@ -352,7 +354,7 @@ static Class<? extends ContainerObj> containerTypeForEntityType(
352354

353355
// per catalog
354356
case CATALOG_ROLE -> CatalogRolesObj.class;
355-
case NAMESPACE, ICEBERG_TABLE_LIKE -> CatalogStateObj.class;
357+
case NAMESPACE, TABLE_LIKE -> CatalogStateObj.class;
356358

357359
default -> throw new IllegalArgumentException("Unsupported entity type: " + entityType);
358360
};
@@ -368,7 +370,7 @@ static Class<? extends ContainerObj> containerTypeForEntityType(
368370

369371
// per catalog
370372
case CATALOG_ROLE -> CatalogRolesObj.builder();
371-
case NAMESPACE, ICEBERG_TABLE_LIKE -> CatalogStateObj.builder();
373+
case NAMESPACE, TABLE_LIKE -> CatalogStateObj.builder();
372374

373375
default -> throw new IllegalArgumentException("Unsupported entity type: " + entityType);
374376
};
@@ -389,13 +391,13 @@ static PolarisBaseEntity mapToEntity(@Nonnull ObjBase objBase, long catalogId) {
389391
switch (objBase) {
390392
case TableLikeObj o -> {
391393
catalogMandatory(catalogId);
392-
type = PolarisEntityType.ICEBERG_TABLE_LIKE;
394+
type = PolarisEntityType.TABLE_LIKE;
393395
o.metadataLocation().ifPresent(v -> internalProperties.put(METADATA_LOCATION_KEY, v));
394396
if (objBase instanceof IcebergTableObj) {
395-
subType = PolarisEntitySubType.TABLE;
397+
subType = ICEBERG_TABLE;
396398
}
397399
if (objBase instanceof IcebergViewObj) {
398-
subType = PolarisEntitySubType.VIEW;
400+
subType = ICEBERG_VIEW;
399401
}
400402
}
401403
case LocalNamespaceObj ignored -> {
@@ -489,12 +491,12 @@ static EntityNameLookupRecord mapToEntityNameLookupRecord(
489491
switch (objBase) {
490492
case TableLikeObj ignored -> {
491493
catalogMandatory(catalogStableId);
492-
type = PolarisEntityType.ICEBERG_TABLE_LIKE;
494+
type = PolarisEntityType.TABLE_LIKE;
493495
if (objBase instanceof IcebergTableObj) {
494-
subType = PolarisEntitySubType.TABLE;
496+
subType = ICEBERG_TABLE;
495497
}
496498
if (objBase instanceof IcebergViewObj) {
497-
subType = PolarisEntitySubType.VIEW;
499+
subType = ICEBERG_VIEW;
498500
}
499501
}
500502
case LocalNamespaceObj ignored -> {
@@ -572,7 +574,7 @@ static String referenceName(PolarisEntityType entityType, long catalogStableId)
572574
// per catalog
573575
case CATALOG_ROLE ->
574576
perCatalogReferenceName(CatalogRolesObj.CATALOG_ROLES_REF_NAME_PATTERN, catalogStableId);
575-
case NAMESPACE, ICEBERG_TABLE_LIKE ->
577+
case NAMESPACE, TABLE_LIKE ->
576578
perCatalogReferenceName(CatalogStateObj.CATALOG_STATE_REF_NAME_PATTERN, catalogStableId);
577579

578580
default -> throw new IllegalArgumentException("Unsupported entity type: " + entityType);
@@ -599,10 +601,10 @@ static String entitySubTypeCodeFromObjType(ObjRef objRef) {
599601
if (objRef != null) {
600602
var objType = ObjTypes.objTypeById(objRef.type());
601603
if (objType.equals(IcebergTableObj.TYPE)) {
602-
return Integer.toString(PolarisEntitySubType.TABLE.getCode());
604+
return Integer.toString(ICEBERG_TABLE.getCode());
603605
}
604606
if (objType.equals(IcebergViewObj.TYPE)) {
605-
return Integer.toString(PolarisEntitySubType.VIEW.getCode());
607+
return Integer.toString(ICEBERG_VIEW.getCode());
606608
}
607609
}
608610
return null;

0 commit comments

Comments
 (0)