dimas-b commented on code in PR #3940:
URL: https://github.com/apache/polaris/pull/3940#discussion_r2921585753


##########
runtime/service/src/testFixtures/java/org/apache/polaris/service/catalog/PolarisPassthroughResolutionView.java:
##########
@@ -65,89 +62,42 @@ public PolarisResolvedPathWrapper 
getResolvedReferenceCatalogEntity() {
   }
 
   @Override
-  public PolarisResolvedPathWrapper getResolvedPath(Object key) {
+  public PolarisResolvedPathWrapper getResolvedPath(ResolvedPathKey key) {
+    Preconditions.checkState(
+        key.entityType() == PolarisEntityType.NAMESPACE,
+        "Trying to getResolvedPath(key) for non-namespace key %s",
+        key);
     PolarisResolutionManifest manifest = newResolutionManifest();
-
-    if (key instanceof Namespace namespace) {
-      manifest.addPath(
-          new ResolverPath(Arrays.asList(namespace.levels()), 
PolarisEntityType.NAMESPACE),
-          namespace);
-      manifest.resolveAll();
-      return manifest.getResolvedPath(namespace);
-    } else {
-      throw new IllegalStateException(
-          String.format(
-              "Trying to getResolvedPath(key) for %s with class %s", key, 
key.getClass()));
-    }
+    manifest.addPath(new ResolverPath(key.entityNames(), key.entityType()));
+    manifest.resolveAll();
+    return manifest.getResolvedPath(key);
   }
 
   @Override
   public PolarisResolvedPathWrapper getResolvedPath(
-      Object key, PolarisEntityType entityType, PolarisEntitySubType subType) {
+      ResolvedPathKey key, PolarisEntitySubType subType) {
     PolarisResolutionManifest manifest = newResolutionManifest();
-
-    if (key instanceof TableIdentifier identifier) {
-      manifest.addPath(
-          new 
ResolverPath(PolarisCatalogHelpers.tableIdentifierToList(identifier), 
entityType),
-          identifier);
-      manifest.resolveAll();
-      return manifest.getResolvedPath(identifier, entityType, subType);
-    } else if (key instanceof PolicyIdentifier policyIdentifier) {
-      manifest.addPath(
-          new ResolverPath(
-              PolarisCatalogHelpers.identifierToList(
-                  policyIdentifier.namespace(), policyIdentifier.name()),
-              entityType),
-          policyIdentifier);
-      manifest.resolveAll();
-      return manifest.getResolvedPath(policyIdentifier, entityType, subType);
-    } else {
-      throw new IllegalStateException(
-          String.format(
-              "Trying to getResolvedPath(key, subType) for %s with class %s 
and type %s / %s",
-              key, key.getClass(), entityType, subType));
-    }
+    manifest.addPath(new ResolverPath(key.entityNames(), key.entityType()));
+    manifest.resolveAll();
+    return manifest.getResolvedPath(key, subType);
   }
 
   @Override
-  public PolarisResolvedPathWrapper getPassthroughResolvedPath(Object key) {
+  public PolarisResolvedPathWrapper getPassthroughResolvedPath(ResolvedPathKey 
key) {
+    Preconditions.checkState(
+        key.entityType() == PolarisEntityType.NAMESPACE,
+        "Trying to getPassthroughResolvedPath(key) for non-namespace key %s",
+        key);
     PolarisResolutionManifest manifest = newResolutionManifest();
-
-    if (key instanceof Namespace namespace) {
-      manifest.addPassthroughPath(
-          new ResolverPath(Arrays.asList(namespace.levels()), 
PolarisEntityType.NAMESPACE),
-          namespace);
-      return manifest.getPassthroughResolvedPath(namespace);
-    } else {
-      throw new IllegalStateException(
-          String.format(
-              "Trying to getResolvedPath(key) for %s with class %s", key, 
key.getClass()));
-    }
+    manifest.addPassthroughPath(new ResolverPath(key.entityNames(), 
key.entityType()));
+    return manifest.getPassthroughResolvedPath(key);
   }
 
   @Override
   public PolarisResolvedPathWrapper getPassthroughResolvedPath(
-      Object key, PolarisEntityType entityType, PolarisEntitySubType subType) {
+      ResolvedPathKey key, PolarisEntitySubType subType) {
     PolarisResolutionManifest manifest = newResolutionManifest();
-
-    if (key instanceof TableIdentifier identifier) {
-      manifest.addPassthroughPath(
-          new 
ResolverPath(PolarisCatalogHelpers.tableIdentifierToList(identifier), 
entityType),
-          identifier);
-      return manifest.getPassthroughResolvedPath(identifier, entityType, 
subType);
-    } else if (key instanceof PolicyIdentifier policyIdentifier) {
-      manifest.addPassthroughPath(
-          new ResolverPath(
-              PolarisCatalogHelpers.identifierToList(
-                  policyIdentifier.namespace(), policyIdentifier.name()),
-              entityType),
-          policyIdentifier);
-      return manifest.getPassthroughResolvedPath(policyIdentifier, entityType, 
subType);
-    } else {
-      throw new IllegalStateException(

Review Comment:
   restore this check too?



-- 
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]

Reply via email to