Skip to content

Hive: Preserve tables and views on mismatched drops - #18691

Merged
pvary merged 3 commits into
apache:mainfrom
binarybrain-009:hive-drop-table-view
Nov 19, 2026
Merged

pvary merged 3 commits into
apache:mainfrom
binarybrain-009:hive-drop-table-view

Conversation

@binarybrain-009

@binarybrain-009 binarybrain-009 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

HiveCatalog.dropTable(view, false) drops an Iceberg view and returns true, because HMS drop_table does not distinguish tables from views; with purge=true the same call throws NoSuchTableException. This returns false in both cases when the identifier is an Iceberg view, matching the Catalog.dropTable contract and the in-memory, JDBC and REST catalogs. The guard reuses viewExists, as registerTable and renameTable do, so dropTable now makes one extra HMS getTable call. Non-Iceberg Hive views and tables are still dropped as before. The reverse operation, dropView at an Iceberg table identifier, now also returns false instead of throwing NoSuchViewException. This refreshes the stale #17279 by @thswlsqls.

Closes #17278

Test plan: Shared catalog tests cover both purge settings for dropTable at a view identifier, and dropView at a table identifier. They verify the original object remains loadable with the same UUID. The new tests pass for Hive, JDBC, in-memory and both REST configurations; the Hive and Nessie view suites and formatting/checkstyle checks also pass. Nessie's inherited mismatch tests are temporarily disabled pending #18912.


AI Disclosure

  • Model: Claude Opus 5.5; GPT-6 (review follow-up)
  • Platform/Tool: Claude Code; Codex (review follow-up)
  • Human Oversight: partially reviewed (earlier changes personally reviewed; November 18 review follow-ups not yet personally reviewed)
  • Prompt Summary: Fix Hive: dropTable silently drops an Iceberg view #17278 (HiveCatalog.dropTable silently drops an Iceberg view); the fix and its tests are generated.

HiveCatalog.dropTable with purge=false dropped an Iceberg view and
returned true, because HMS drop_table does not distinguish tables from
views. With purge=true the same call threw NoSuchTableException. Return
false in both cases, matching the Catalog.dropTable contract and the
other catalogs.

Closes apache#17278
@github-actions github-actions Bot added the hive label Oct 29, 2026
Move both purge cases into ViewCatalogTests. Hive, JDBC, in-memory and REST pass; temporarily disable the inherited Nessie case pending the separate fix in apache#18912.

Generated-by: Codex
@pvary

pvary commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

@binarybrain-009: Are you a human, could you please review the changes?

@binarybrain-009

Copy link
Copy Markdown
Contributor Author

@pvary I've personally reviewed the current changes, including the shared test and the Nessie follow-up, and updated the human-review disclosure. Thanks for taking another look.

@binarybrain-009 binarybrain-009 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I am a real human lol I have reviewed it. But with AI tools most of the responses and code is AI generated lol but yeah I review it but yeah updated disclosure etc

@binarybrain-009 binarybrain-009 changed the title Hive: Do not drop Iceberg views in dropTable Hive: Preserve tables and views on mismatched drops Nov 19, 2026
@binarybrain-009

Copy link
Copy Markdown
Contributor Author

@pvary Addressed in 65bfafc. Renamed the shared test to dropTableThatAlreadyExistsAsView and added a loadView check against the original UUID. Added dropViewThatAlreadyExistsAsTable with the same preservation check for tables. That exposed Hive throwing NoSuchViewException for this case, so dropView now returns false. The shared cases pass for Hive, JDBC, in-memory and both REST configurations, and the Hive and Nessie view suites and formatting/checkstyle checks pass. Both Nessie mismatch tests are temporarily disabled pending #18912, which now fixes both directions. Could you take another look? These latest follow-ups were generated with Codex and are marked as awaiting my personal review in the disclosure.

@binarybrain-009

Copy link
Copy Markdown
Contributor Author

addressed the reivew comments and reviewed as a human

@pvary
pvary merged commit ff85472 into apache:main Nov 19, 2026
40 of 41 checks passed
@pvary

pvary commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Merged to main.
Thanks @binarybrain-009 for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hive: dropTable silently drops an Iceberg view

2 participants