collado-mike commented on code in PR #585:
URL: https://github.com/apache/polaris/pull/585#discussion_r1894259785
##########
service/common/src/main/java/org/apache/polaris/service/catalog/BasePolarisCatalog.java:
##########
@@ -554,14 +554,27 @@ 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
default 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);
+ }
+ return entityName;
Review Comment:
Same here - there should never be an entity without a name.
##########
service/common/src/main/java/org/apache/polaris/service/catalog/BasePolarisCatalog.java:
##########
@@ -554,14 +554,27 @@ 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
default base location. Catalog = {}",
+ catEntity);
+ }
+ return catalogDefaultBaseLocation;
Review Comment:
Should a catalog ever have a null base location? This feels like a case for
`PolarisDiagnostics.checkNotNull` rather than a log statement.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]