-
Notifications
You must be signed in to change notification settings - Fork 3k
Hadoop drop table to return false if table does not exist #3097
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…stead of throwing exception
| TableMetadata lastMetadata = ops.current(); | ||
| if (lastMetadata == null) { | ||
| LOG.error("Not an iceberg table: %s", identifier); | ||
| return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer keeping the returns in the same if block as the other return statement. I tend to always lean towards single or very closely located exits from functions so it's clear that you either return this or that.
Like if you had it as
if (lastMetadata == null) {
LOG.error(....)
return false
} else {
return fs.delete(...)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have tried doing something similar in the latest commit, please review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this is fixed to me.
RussellSpitzer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, a few minor comments but we definitely need some tests to make sure we can hit all of the different return points in this code. I would suggest adding some to TestHadoopCatalog.java
|
Have added test for the other case of exit because of non iceberg table, please review. |
core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java
Outdated
Show resolved
Hide resolved
core/src/test/java/org/apache/iceberg/hadoop/TestHadoopCatalog.java
Outdated
Show resolved
Hide resolved
core/src/test/java/org/apache/iceberg/hadoop/TestHadoopCatalog.java
Outdated
Show resolved
Hide resolved
RussellSpitzer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest adding one more test to make sure we return false when the table doesn't exist at all (no folder or anything)
|
@itachi-sharingan, could you add the test that Russell suggested and fix the failing CI checks? Otherwise, I think this is about ready to go. |
|
@rdblue have fixed the failing CI. |
|
Thanks, @itachi-sharingan! I reopened this so that I could merge it. There's no need to close a PR when it is finished. If you're looking for another contribution, #2488 is a good one! Thanks for contributing! |
closes #3051