HIVE-28757: Preserve partition create time - #6631
Draft
myg821561935 wants to merge 1 commit into
Draft
Conversation
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Supersedes #6628. GitHub closed the earlier PR automatically when its source branch was renamed; the commit itself is unchanged.
What changes were proposed in this pull request?
Keep the
Partitionobjects returned by HMS in the single-partition and batch dynamic-partition load paths. The batch path now requests the partitions returned byadd_partitionsand uses them in the result map.On the metastore side, preserve the existing partition
createTimewhen an alter request carries an unset or non-positive value. This covers single, rename, and batch alter paths.Regression tests were added for both the load and alter cases.
Why are the changes needed?
HMS assigns server-owned fields such as
createTimewhen a partition is added. The load path currently discards the partition returned by HMS and keeps using the request-side object, whosecreateTimeis still zero. A later statistics update can send that object throughalter_partitionand overwrite the value stored by HMS with zero.This makes the partition creation time unreliable for retention and lifecycle management.
Does this PR introduce any user-facing change?
Yes. A newly created partition keeps the creation time assigned by HMS instead of having it reset to zero by a later alter operation. There is no public API change.
How was this patch tested?
TestHiveLoadPartitionKeepExisting: 5 tests passed, including the new static and dynamic partition cases.TestAlterPartitions: 154 tests passed, including the new single and batch alter cases.JIRA: https://issues.apache.org/jira/browse/HIVE-28757