Skip to content

HIVE-29116 : Create a DDL for setting hive default partition name at the table level #6013

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

vikramahuja1001
Copy link
Contributor

  1. Expose a DDL to set default partition name at table level
  2. Restrict set hive.exec.default.partition at runtime
  3. use table property to check the default partition along with hive.exec.default.partition at cluster level

For more details refer: https://issues.apache.org/jira/browse/HIVE-29116

What changes were proposed in this pull request?

Why are the changes needed?

Does this PR introduce any user-facing change?

How was this patch tested?

@vikramahuja1001
Copy link
Contributor Author

@deniskuzZ , @chinnaraolalam could you please take a look at this PR?

Copy link
Contributor

@ngsg ngsg left a comment

Choose a reason for hiding this comment

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

Hi @vikramahuja1001, I have the same concern about setting the default partition name, and I'm glad to see the patch addressing it. I have reviewed the changes, except for HiveAlterHandler.java (I need more time to study the changes and the relevant context), and left comments on the places where I have questions. Could you please review my comments on the changes?


set hive.msck.path.validation=skip;

MSCK REPAIR TABLE tbl_y;

SHOW PARTITIONS tbl_y;

SET hive.exec.default.partition.name=SECOND_PARTITION;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a test to validate hive.exec.default.partition.name is no more session configurable

@vikramahuja1001
Copy link
Contributor Author

vikramahuja1001 commented Aug 13, 2025

Thanks for reviewing this PR @ngsg @Indhumathi27
I will handle the review comments, push the changes soon.

@Aggarwal-Raghav
Copy link
Contributor

@vikramahuja1001 , i think change is required in org.apache.hadoop.hive.ql.exec.DDLPlanUtils#checkIfDefaultPartition()

if (pt.contains(HIVE_DEFAULT_PARTITION)) {

@Aggarwal-Raghav
Copy link
Contributor

Aggarwal-Raghav commented Aug 14, 2025

Remove hardcoding from here as well + update comments as well accordingly
org.apache.hadoop.hive.common.FileUtils#escapePathName(java.lang.String, java.lang.String)

return "__HIVE_DEFAULT_PARTITION__";

@Aggarwal-Raghav
Copy link
Contributor

Remove hardcoding from following place:

dynPathSpec = dynPathSpec.replace("__HIVE_DEFAULT_PARTITION__", "*");

@vikramahuja1001
Copy link
Contributor Author

@Aggarwal-Raghav ,very good point, makes sense. Thanks for pointing this out. There are indeed a lot of places where HIVE_DEFAULT_PARTITION is hard coded. Have put a few commits to fix that.

Copy link

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.

5 participants