huan233usc commented on code in PR #12014:
URL: https://github.com/apache/iceberg/pull/12014#discussion_r2009016220


##########
core/src/main/java/org/apache/iceberg/view/BaseMetastoreViewCatalog.java:
##########
@@ -67,6 +71,31 @@ public View loadView(TableIdentifier identifier) {
     throw new NoSuchViewException("Invalid view identifier: %s", identifier);
   }
 
+  @Override
+  public Table loadTable(TableIdentifier identifier) {
+    try {
+      return super.loadTable(identifier);
+    } catch (NoSuchTableException e) {
+      return loadViewMetadataTable(identifier);
+    }
+  }
+
+  private Table loadViewMetadataTable(TableIdentifier identifier) {
+    String tableName = identifier.name();
+    ViewMetadataTableType type = ViewMetadataTableType.from(tableName);
+    if (type != null) {
+      TableIdentifier baseViewIdentifier = 
TableIdentifier.of(identifier.namespace().levels());
+      ViewOperations ops = newViewOps(baseViewIdentifier);
+      if (ops.current() == null) {
+        throw new NoSuchTableException("Table or View does not exist: %s", 
baseViewIdentifier);
+      }

Review Comment:
   Done



-- 
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...@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to