github-actions[bot] commented on code in PR #69486:
URL: https://github.com/apache/doris/pull/69486#discussion_r4355003138


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalCatalog.java:
##########
@@ -1290,6 +1292,24 @@ public void dropTable(String dbName, String tableName, 
boolean isView, boolean i
             }
             throw new DdlException("Failed to get table: '" + tableName + "' 
in database: " + dbName);
         }
+        // The metadata API receives no kind/lifetime flags and may purge an 
ordinary table.
+        // External catalogs have no temporary tables or MTMVs; reject 
mismatches before dispatch.
+        if (mustTemporary) {
+            if (ifExists) {
+                return;
+            }
+            ErrorReport.reportDdlException(ErrorCode.ERR_UNKNOWN_TABLE, 
tableName, dbName);
+        }
+        if (isMtmv) {
+            ErrorReport.reportDdlException(ErrorCode.ERR_WRONG_OBJECT, dbName, 
tableName, "MTMV",
+                    "External catalogs do not support materialized views");
+        }
+        boolean actualIsView = dorisTable.isView();

Review Comment:
   [P2] Check HMS object kind without validating its scan format
   
   For a nontransactional Hive table stored as Avro (also RCFile or 
SequenceFile), a matching `DROP TABLE hms.db.t` now fails here: 
`HMSExternalTable.isView()` calls `makeSureInitialized()`, which calls 
`supportedHiveTable()` and throws `Unsupported hive input format` before 
reaching the drop API. Previously `getTableNullable()` only constructed the 
shell, and `HiveMetadataOps.dropTableImpl()` checked existence/transactional 
status without requiring a readable format. Thus this shared guard removes a 
working metadata operation for tables Doris cannot scan. Resolve the kind from 
raw metastore metadata without scan-format validation, and cover this with a 
real HMS table rather than a mocked `isView()`.



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalCatalog.java:
##########
@@ -1290,6 +1292,24 @@ public void dropTable(String dbName, String tableName, 
boolean isView, boolean i
             }
             throw new DdlException("Failed to get table: '" + tableName + "' 
in database: " + dbName);
         }
+        // The metadata API receives no kind/lifetime flags and may purge an 
ordinary table.
+        // External catalogs have no temporary tables or MTMVs; reject 
mismatches before dispatch.
+        if (mustTemporary) {
+            if (ifExists) {
+                return;
+            }
+            ErrorReport.reportDdlException(ErrorCode.ERR_UNKNOWN_TABLE, 
tableName, dbName);
+        }
+        if (isMtmv) {
+            ErrorReport.reportDdlException(ErrorCode.ERR_WRONG_OBJECT, dbName, 
tableName, "MTMV",
+                    "External catalogs do not support materialized views");
+        }
+        boolean actualIsView = dorisTable.isView();

Review Comment:
   [P2] Preserve IF EXISTS for stale HMS table names
   
   Populate Doris' HMS table-name cache (for example with `SHOW TABLES`), 
delete `t` directly in Hive, then run `DROP TABLE IF EXISTS hms.db.t` before 
the name cache refreshes. `getTableNullable()` can still construct a cold shell 
from the cached name, so the null check above does not handle this case. The 
new `HMSExternalTable.isView()` call loads the now-missing table and throws 
`HMSClientException` before `HiveMetadataOps.dropTableImpl()` can perform its 
existing `tableExists == false && ifExists` no-op. This previously successful 
idempotent drop now fails. Preserve remote-missing IF EXISTS semantics during 
kind resolution, and test a stale name with a real HMS shell rather than only 
mocking a null lookup.



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalCatalog.java:
##########
@@ -1290,6 +1292,24 @@ public void dropTable(String dbName, String tableName, 
boolean isView, boolean i
             }
             throw new DdlException("Failed to get table: '" + tableName + "' 
in database: " + dbName);
         }
+        // The metadata API receives no kind/lifetime flags and may purge an 
ordinary table.
+        // External catalogs have no temporary tables or MTMVs; reject 
mismatches before dispatch.
+        if (mustTemporary) {
+            if (ifExists) {
+                return;
+            }
+            ErrorReport.reportDdlException(ErrorCode.ERR_UNKNOWN_TABLE, 
tableName, dbName);
+        }
+        if (isMtmv) {
+            ErrorReport.reportDdlException(ErrorCode.ERR_WRONG_OBJECT, dbName, 
tableName, "MTMV",
+                    "External catalogs do not support materialized views");
+        }
+        boolean actualIsView = dorisTable.isView();
+        if (isView != actualIsView) {

Review Comment:
   [P2] Keep failed Iceberg kind probes retryable
   
   For an existing V1 view with a cold `IcebergExternalTable` shell, let the 
first `DROP VIEW` encounter a transient SQL or metadata-read error in 
`viewExists`. `IcebergExternalTable.makeSureInitialized()` sets `objectCreated 
= true` before assigning `isView`, so the failure leaves the cached shell 
initialized with `isView = false`. No drop hook invalidates it. After the 
backend recovers, retrying the matching `DROP VIEW` now hits this mismatch and 
reports `is not VIEW` until refresh or cache expiry. Before this change, 
`dropTableImpl()` probed the remote kind afresh and the retry could succeed. 
Publish kind initialization only after a successful probe, or obtain reliable 
fresh classification here; add a failure-then-retry test using the real shell.



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