Skip to content

Conversation

@itachi-sharingan
Copy link
Contributor

@itachi-sharingan itachi-sharingan commented Sep 10, 2021

closes #3051

@github-actions github-actions bot added the core label Sep 10, 2021
TableMetadata lastMetadata = ops.current();
if (lastMetadata == null) {
LOG.error("Not an iceberg table: %s", identifier);
return false;
Copy link
Member

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(...)
}

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Member

@RussellSpitzer RussellSpitzer left a 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

@itachi-sharingan
Copy link
Contributor Author

Have added test for the other case of exit because of non iceberg table, please review.

Copy link
Member

@RussellSpitzer RussellSpitzer left a 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)

@rdblue
Copy link
Contributor

rdblue commented Sep 13, 2021

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

@itachi-sharingan
Copy link
Contributor Author

itachi-sharingan commented Sep 13, 2021

@rdblue have fixed the failing CI.
@RussellSpitzer have added the check for non existent directory drop returning false in the same test.
Hence, I am closing this pr.
Moreover, can someone please suggest what would be a good issue to pick up next?

@rdblue rdblue reopened this Sep 13, 2021
@rdblue rdblue merged commit 9156464 into apache:master Sep 13, 2021
@rdblue
Copy link
Contributor

rdblue commented Sep 13, 2021

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!

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.

Hadoop Catalog DropTable always returns true and doesn't check that the folder contains Iceberg metadata

3 participants