Skip to content
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

[hotfix] Fix drop database not working in terminal #3363

Merged
merged 10 commits into from
Dec 31, 2024

Conversation

MarigWeizhi
Copy link
Contributor

@MarigWeizhi MarigWeizhi commented Dec 10, 2024

Why are the changes needed?

Close #xxx.

Brief change log

  • Added the dropNamespace to support cascade or non-cascade in SparkUnifiedCatalogBase for spark 3.3
  • spark 3.2 will use false by default

How was this patch tested?

  • Add some test cases that check the changes thoroughly including negative and positive cases if possible

  • Add screenshots for manual tests if appropriate

  • Run test locally before making a pull request

Documentation

  • Does this pull request introduce a new feature? ( no)
  • If yes, how is the feature documented? (not documented)

@github-actions github-actions bot added the module:mixed-spark Spark module for Mixed Format label Dec 10, 2024
@MarigWeizhi MarigWeizhi changed the title [hotfix] Implement dropNamespace [hotfix] Fix drop database not working in terminal Dec 10, 2024
Copy link
Contributor

@huyuanfeng2018 huyuanfeng2018 left a comment

Choose a reason for hiding this comment

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

Should we add a test to guard against future regression?

@MarigWeizhi
Copy link
Contributor Author

Should we add a test to guard against future regression?

Added test, PTAL

Copy link
Contributor

@huyuanfeng2018 huyuanfeng2018 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

throw new NoSuchNamespaceException(namespace);
}
List<TableIDWithFormat> tables = unifiedCatalog.listTables(database);
if (!tables.isEmpty() && !cascade) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not drop all tables first and then drop the database?

I think should this logic be implemented directly by the parent (spark-common).
We already have concrete logic in SparkUnifiedCatalogBase.dropNamespace.
so,remove Override is enough.

WDYT?

Copy link
Contributor

@zhoujinsong zhoujinsong Dec 20, 2024

Choose a reason for hiding this comment

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

I agreed that we may reuse some implementation in the parent class. However I think it is dangerous to delete all tables by default in Spark 3.2 implementation. So we may:

  • Add a method in the base class to support dropping namespace cascade or not.
  • Drop namespace by default with false for Spark 3.2

@MarigWeizhi
Copy link
Contributor Author

MarigWeizhi commented Dec 20, 2024

Thanks for your review @zhoujinsong @huyuanfeng2018
I updated the code, I implemented the method to support cascade or non-cascade in base instead of spark 3.3.
spark 3.2 will use false by default

Copy link
Contributor

@huyuanfeng2018 huyuanfeng2018 left a comment

Choose a reason for hiding this comment

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

just a nit comment

Copy link
Contributor

@huyuanfeng2018 huyuanfeng2018 left a comment

Choose a reason for hiding this comment

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

LGTM.

@zhoujinsong zhoujinsong merged commit 907973e into apache:master Dec 31, 2024
1 check passed
@zhoujinsong
Copy link
Contributor

Thanks for the contribution! @MarigWeizhi
Thanks for the review! @huyuanfeng2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module:mixed-spark Spark module for Mixed Format
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants