-
Notifications
You must be signed in to change notification settings - Fork 4.7k
HIVE-28848:Remove DFS_URI auth from ALTER_PARTITION if there is no ch… #5766
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
base: master
Are you sure you want to change the base?
Conversation
…ange in partition location
|
@@ -6051,8 +6051,9 @@ private void alter_partition_core(String catName, String db_name, String tbl_nam | |||
Exception ex = null; | |||
try { | |||
Table table = getMS().getTable(catName, db_name, tbl_name, null); | |||
Partition oldPartition = getMS().getPartition(catName, db_name, tbl_name, part_vals); |
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.
nit: we fetch oldPart at L6062, can you see if you can eliminate this redundant call?
if (StringUtils.isNotEmpty(newUri)) { | ||
ret.add(getHivePrivilegeObjectDfsUri(newUri)); | ||
// Skip DFS_URI auth if old and new partition uri are empty or same | ||
if (StringUtils.isNotEmpty(newUri) && StringUtils.isNotEmpty(oldUri) && !StringUtils.equalsIgnoreCase(oldUri, |
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.
Do we need DFS_URI
auth when newUri
is not empty but oldUri
is empty? Also consider add unit test for this change.
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.
change the condition to StringUtils.isNotEmpty(newUri) & !StringUtils.equalsIgnoreCase(oldUri, newUri)
?
@@ -76,10 +76,15 @@ private List<HivePrivilegeObject> getOutputHObjs() { | |||
ret.add(getHivePrivilegeObject(event.getTable())); | |||
|
|||
Partition newPartition = event.getNewPartition(); | |||
Partition oldPartition = event.getOldPart(); |
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.
how get the oldPartition
by
Partition oldPartition = Hive.get().getPartition(event.getTable(), Warehouse.makeSpecFromValues(event.getTable().getPartitionKeys(), event.getOldPartVals()));
this can avoid the modification on PreAlterPartitionEvent
and HMSHandler
…ange in partition location
What changes were proposed in this pull request?
This change skips the DFS_URI authorization if there is no change in the PARTITION location in the ALTER_PARTITION event.
If the old partition and new partition Uri are the same or the old partition location is empty, then skip adding DFS_URI for authorization.
Why are the changes needed?
The LOAD DATA command invokes the ALTER_PARTITION event to update stats for the newly loaded partition. ALTER_PARTITION authorizes DFS_URI for the partition location even when the partition locations do not change. This requires the Hadoop SQL policy for DFS_URI to be defined for the partition location for LOAD DATA commands.
Does this PR introduce any user-facing change?
Yes, after this change, users will no longer need the DFS_URI policy for target table partition location.
Is the change a dependency upgrade?
No
How was this patch tested?
Manual testing