pvary commented on code in PR #17873:
URL: https://github.com/apache/iceberg/pull/17873#discussion_r3987056263


##########
flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java:
##########
@@ -378,18 +434,29 @@ private Table loadIcebergTable(ObjectPath tablePath) 
throws TableNotExistExcepti
 
   @Override
   public boolean tableExists(ObjectPath tablePath) throws CatalogException {
-    return icebergCatalog.tableExists(toIdentifier(tablePath));
+    TableIdentifier identifier = toIdentifier(tablePath);
+    return icebergCatalog.tableExists(identifier)
+        || (canBeView(tablePath) && asViewCatalog.viewExists(identifier));
   }
 
   @Override
   public void dropTable(ObjectPath tablePath, boolean ignoreIfNotExists)
       throws TableNotExistException, CatalogException {
+    TableIdentifier identifier = toIdentifier(tablePath);
+
+    boolean dropped;
     try {
-      icebergCatalog.dropTable(toIdentifier(tablePath));
+      dropped = icebergCatalog.dropTable(identifier);
     } catch (org.apache.iceberg.exceptions.NoSuchTableException e) {
-      if (!ignoreIfNotExists) {
-        throw new TableNotExistException(getName(), tablePath, e);
-      }
+      dropped = false;
+    }
+
+    if (!dropped && canBeView(tablePath)) {
+      dropped = asViewCatalog.dropView(identifier);
+    }
+
+    if (!dropped && !ignoreIfNotExists) {
+      throw new TableNotExistException(getName(), tablePath);

Review Comment:
   Previously, we did not throw if the `dropped` was false for a table.
   
   What is the expected behavior in Flink?
   If this needs to be fixed, shall we do it in a different PR?
   



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to