thswlsqls opened a new pull request, #17279:
URL: https://github.com/apache/iceberg/pull/17279

   Closes #17278
   
   ## Summary
   
   - `HiveCatalog.dropTable(identifier, false)` silently drops an Iceberg view 
and returns `true`: the only view check (`ops.current()`) is inside the `if 
(purge)` branch, and HMS `drop_table` does not distinguish tables from views. 
This breaks the `Catalog.dropTable` contract ("false if the table did not 
exist") and contradicts `tableExists(viewId)`.
   - Adds a `viewExists` guard at the entry point, reusing `registerTable`'s 
check (line 943-949); `dropTable` was the only path missing it.
   - **`purge=true` also changes**: returns `false` instead of propagating 
`NoSuchTableException`. Intentional — the guard is outside the `purge` branch, 
and the method already maps that exception to `false` (line 278-280).
   - **Iceberg views only** — non-Iceberg `VIRTUAL_VIEW`s are still dropped 
(out of scope).
   - **Costs one extra HMS `getTable`**, a tradeoff `registerTable` accepts.
   - `InMemoryCatalog`, `JdbcCatalog`, and REST already return `false` here; 
Hive diverges only because HMS keeps tables and views in one namespace. 
`NoSuchTableException` is the alternative, but `false` matches the Javadoc and 
every sibling.
   
   ## Testing done
   
   - Added `TestHiveViewCatalog#dropTableShouldNotDropIcebergView`, asserting 
the view survives. Fails on `main` (returns `true`, view dropped), passes here.
   - `./gradlew :iceberg-hive-metastore:check` — 309 tests passed.
   - Not a REVAPI module; signatures unchanged.
   
   


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