Skip to content

Commit

Permalink
Add log line to debug npe in resolveLocationForPath
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-dzhang committed Dec 19, 2024
1 parent b069591 commit 68a7750
Showing 1 changed file with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -554,14 +554,33 @@ private String resolveNamespaceLocation(Namespace namespace, Map<String, String>
.map(
entity -> {
if (entity.getType().equals(PolarisEntityType.CATALOG)) {
return CatalogEntity.of(entity).getDefaultBaseLocation();
CatalogEntity catEntity = CatalogEntity.of(entity);
String catalogDefaultBaseLocation = catEntity.getDefaultBaseLocation();
if (catalogDefaultBaseLocation == null) {
LOGGER.warn(
"Tried to resolve location with catalog with null defalut base location. Catalog = {}",
catEntity);
throw new RuntimeException(
"Tried to resolve location with catalog with null defalut base location. Catalog = "
+ catEntity);
}
return catalogDefaultBaseLocation;
} else {
String baseLocation =
entity.getPropertiesAsMap().get(PolarisEntityConstants.ENTITY_BASE_LOCATION);
if (baseLocation != null) {
return baseLocation;
} else {
return entity.getName();
String entityName = entity.getName();
if (entityName == null) {
LOGGER.warn(
"Tried to resolve location with entity without base location or name. entity = {}",
entity);
throw new RuntimeException(
"Tried to resolve location with entity without base location or name. entity = "
+ entity);
}
return entityName;
}
}
})
Expand Down

0 comments on commit 68a7750

Please sign in to comment.