Skip to content

HIVE-28757: Preserve partition create time - #6631

Draft
myg821561935 wants to merge 1 commit into
apache:masterfrom
myg821561935:hive-28757-partition-create-time
Draft

HIVE-28757: Preserve partition create time#6631
myg821561935 wants to merge 1 commit into
apache:masterfrom
myg821561935:hive-28757-partition-create-time

Conversation

@myg821561935

Copy link
Copy Markdown

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 Partition objects returned by HMS in the single-partition and batch dynamic-partition load paths. The batch path now requests the partitions returned by add_partitions and uses them in the result map.

On the metastore side, preserve the existing partition createTime when 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 createTime when a partition is added. The load path currently discards the partition returned by HMS and keeps using the request-side object, whose createTime is still zero. A later statistics update can send that object through alter_partition and 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.
  • The related 21-module Maven reactor completed successfully with JDK 21.

JIRA: https://issues.apache.org/jira/browse/HIVE-28757

@sonarqubecloud

Copy link
Copy Markdown

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.

2 participants