Apache Iceberg version
main @ 8550723
Query engine
None — the bug is in HiveCatalog and is engine-agnostic.
Please describe the bug
HiveCatalog.dropTable(identifier, false) does not check whether the identifier refers to an Iceberg view, so it silently drops the view and returns true (HiveCatalog.java line 240-289). The only view check is ops.current(), which sits inside the if (purge) branch, so purge=false reaches client.dropTable(...) unvalidated. HMS drop_table does not distinguish tables from views.
This breaks the Catalog.dropTable contract: "true if the table was dropped, false if the table did not exist" (api/.../catalog/Catalog.java line 305). A view is not a table.
It is inconsistent within the class too: tableExists(viewId) returns false, yet dropTable(viewId, false) drops that view. registerTable (line 943-949) and both builders already guard against table/view confusion; dropTable is the only path missing it.
InMemoryCatalog, JdbcCatalog, and REST already return false here; HiveCatalog is the only catalog affected.
Steps to reproduce
- Create an Iceberg view
v via HiveCatalog.
- Call
catalog.dropTable(v, false).
Expected: returns false, view survives.
Actual: returns true, the view is gone.
With purge=true the same call instead propagates NoSuchTableException, so behavior splits on the purge flag.
Additional context
N/A
Apache Iceberg version
main @ 8550723
Query engine
None — the bug is in
HiveCatalogand is engine-agnostic.Please describe the bug
HiveCatalog.dropTable(identifier, false)does not check whether the identifier refers to an Iceberg view, so it silently drops the view and returnstrue(HiveCatalog.javaline 240-289). The only view check isops.current(), which sits inside theif (purge)branch, sopurge=falsereachesclient.dropTable(...)unvalidated. HMSdrop_tabledoes not distinguish tables from views.This breaks the
Catalog.dropTablecontract: "true if the table was dropped, false if the table did not exist" (api/.../catalog/Catalog.javaline 305). A view is not a table.It is inconsistent within the class too:
tableExists(viewId)returnsfalse, yetdropTable(viewId, false)drops that view.registerTable(line 943-949) and both builders already guard against table/view confusion;dropTableis the only path missing it.InMemoryCatalog,JdbcCatalog, and REST already returnfalsehere; HiveCatalog is the only catalog affected.Steps to reproduce
vviaHiveCatalog.catalog.dropTable(v, false).Expected: returns
false, view survives.Actual: returns
true, the view is gone.With
purge=truethe same call instead propagatesNoSuchTableException, so behavior splits on thepurgeflag.Additional context
N/A