Skip to content

Fix reading specifying format for date partition projection in Hive connector #25817

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 2 commits into
base: master
Choose a base branch
from

Conversation

chenjian2664
Copy link
Contributor

@chenjian2664 chenjian2664 commented May 18, 2025

Description

Closes #25642

Make the partition value Hive format compatible during partition generation.
The pr is assume the underlay table path of partition is all Hive compatible format, partitionName=${value}, even the customed partition projection is specified.

Additional context and related issues

Alternative for #25657

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(x) Release notes are required, with the following suggested text:

## Hive
* Fix reading specifying format for date partition projection in Hive connector. ({issue}`25642`)

Replace legacy formatting with `DateTimeFormatter` for better compatibility
 with the `java.time` package, providing more precise and predictable behavior
This refactor follows AWS Athena's date-type partition projection format
(https://docs.aws.amazon.com/athena/latest/ug/partition-projection-supported-types.html)
in the description.
Additionally, this commit replaces the error-prone Supplier<Instant>
with a direct Instant type for `leftBound` and `rightBound`.
@cla-bot cla-bot bot added the cla-signed label May 18, 2025
@github-actions github-actions bot added the hive Hive connector label May 18, 2025
Transform user-specified date partition projection format into
 Hive-compatible format for partition consistency.
@chenjian2664 chenjian2664 force-pushed the ref_date_projection branch from af8efa8 to 6ef1fa6 Compare May 18, 2025 13:52
@chenjian2664 chenjian2664 requested a review from pettyjamesm May 19, 2025 01:05
@@ -138,7 +142,7 @@ public List<String> getProjectedValues(Optional<Domain> partitionValueFilter)

Instant currentValue = leftBound;
while (!currentValue.isAfter(rightBound)) {
String currentValueFormatted = formatValue(currentValue);
String currentValueFormatted = formatValueToHiveCompatibleFormat(currentValue);
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is the intended behavior here- when we're enumerating the partition values we want to respect whatever format is specified for the timestamp and not limit it to the Hive compatible encoding. Otherwise #25642 isn't actually fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed hive Hive connector
Development

Successfully merging this pull request may close these issues.

Hive partition projection date partition values are not parsed with partition_projection_format
2 participants