Skip to content

Hive: Avoid drop table related exceptions in MetaHook#2191

Merged
pvary merged 7 commits into
apache:masterfrom
marton-bod:drop_table_fix
Feb 5, 2021
Merged

Hive: Avoid drop table related exceptions in MetaHook#2191
pvary merged 7 commits into
apache:masterfrom
marton-bod:drop_table_fix

Conversation

@marton-bod

@marton-bod marton-bod commented Feb 1, 2021

Copy link
Copy Markdown
Collaborator

There are a couple of scenarios where the Hive DDL command DROP TABLE can produce an error unnecessarily.

  1. Currently on Hive4, DROP TABLE can result in a FileNotFoundException exception, because based on Hive2/Hive3 behaviour, the current assumption is that the HiveIcebergMetaHook has to clean up the metadata files after the Hive drop table has completed. However, in Hive4, if external.table.purge=TRUE is set, Hive will wipe the metadata folder as well.
  2. When creating a Hive table on top of an existing table in a different catalog, if we drop the table in Hive but the underlying table does not exist anymore (e.g. in the HadoopCatalog), we'd also end up with an exception.

Extended some of the unit tests with explicit DROP TABLE commands in the end to test for the whole flow of CREATE, INSERT, DROP (which currently triggers problem # 1 on Hive4).

@github-actions github-actions Bot added the MR label Feb 1, 2021
@marton-bod

Copy link
Copy Markdown
Collaborator Author

@pvary Can you please take a look? Thanks!

Comment thread mr/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java Outdated

@pvary pvary left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just a minor comment, but LGTM

@marton-bod

Copy link
Copy Markdown
Collaborator Author

Thanks for your review @pvary!

@pvary pvary merged commit 469f6c3 into apache:master Feb 5, 2021
@pvary

pvary commented Feb 5, 2021

Copy link
Copy Markdown
Contributor

Thanks for the fix @marton-bod

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants