XN137 commented on code in PR #2302:
URL: https://github.com/apache/polaris/pull/2302#discussion_r2302820925


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java:
##########
@@ -570,12 +573,15 @@ public boolean sendNotification(TableIdentifier 
identifier, NotificationRequest
    * Fetch the metastore table entity for the given table identifier
    *
    * @param tableIdentifier The identifier of the table
-   * @return the Polaris table entity for the table
+   * @return the Polaris table entity for the table or null for external 
catalogs
    */
-  private IcebergTableLikeEntity getTableEntity(TableIdentifier 
tableIdentifier) {
+  private @Nullable IcebergTableLikeEntity getTableEntity(TableIdentifier 
tableIdentifier) {
     PolarisResolvedPathWrapper target = 
resolutionManifest.getResolvedPath(tableIdentifier);
-
-    return IcebergTableLikeEntity.of(target.getRawLeafEntity());
+    PolarisEntity rawLeafEntity = target.getRawLeafEntity();
+    if (rawLeafEntity.getType() == PolarisEntityType.TABLE_LIKE) {
+      return IcebergTableLikeEntity.of(rawLeafEntity);
+    }
+    return null; // could be an external catalog

Review Comment:
   idk how external catalog integration works under the hood but in the first 
output line (that i had added) we can see that the `PolarisResolvedPathWrapper` 
ends up pointing to the external catalog entity (which is also the leaf 
element).
   
   so i assumed for external catalogs in general we dont have any actual entity 
representing the table? but maybe this is just an artifact of an incorrectly 
written test idk.
   
   the return value of `getTableEntity` is only used for supporting ETags not 
for loading the table:
   
https://github.com/apache/polaris/blob/3f1dfb332b84e0eeeab5411b333883790273f504/runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java#L601-L619



-- 
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: issues-unsubscr...@polaris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to