-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Conversation
af8efa8 to
6ef1fa6
Compare
plugin/trino-hive/src/main/java/io/trino/plugin/hive/projection/DateProjection.java
Outdated
Show resolved
Hide resolved
6ef1fa6 to
bc09276
Compare
plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveMetadata.java
Outdated
Show resolved
Hide resolved
plugin/trino-hive/src/main/java/io/trino/plugin/hive/projection/PartitionProjection.java
Outdated
Show resolved
Hide resolved
plugin/trino-hive/src/main/java/io/trino/plugin/hive/projection/PartitionProjection.java
Outdated
Show resolved
Hide resolved
e60ed0f to
6c9b3ea
Compare
|
Hi folks - any progress on this one? I'm writing an article explaining how to use Trino to query access logs, and I've had to include a caveat explaining that partition projection currently doesn't work, so time-based queries scan all rows, rather than just those included by the query conditions. |
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`.
6c9b3ea to
ab6238b
Compare
3d352bd to
e8232e7
Compare
plugin/trino-hive/src/main/java/io/trino/plugin/hive/projection/PartitionProjection.java
Outdated
Show resolved
Hide resolved
plugin/trino-hive/src/main/java/io/trino/plugin/hive/projection/PartitionProjection.java
Outdated
Show resolved
Hide resolved
plugin/trino-hive/src/main/java/io/trino/plugin/hive/projection/PartitionProjection.java
Outdated
Show resolved
Hide resolved
plugin/trino-hive/src/main/java/io/trino/plugin/hive/projection/Projection.java
Outdated
Show resolved
Hide resolved
plugin/trino-hive/src/main/java/io/trino/plugin/hive/projection/DateProjection.java
Outdated
Show resolved
Hide resolved
e8232e7 to
19099b7
Compare
|
@pettyjamesm comments addressed, PTAL |
plugin/trino-hive/src/main/java/io/trino/plugin/hive/projection/Projection.java
Outdated
Show resolved
Hide resolved
plugin/trino-hive/src/main/java/io/trino/plugin/hive/projection/PartitionProjection.java
Show resolved
Hide resolved
plugin/trino-hive/src/main/java/io/trino/plugin/hive/projection/PartitionProjection.java
Outdated
Show resolved
Hide resolved
plugin/trino-hive/src/main/java/io/trino/plugin/hive/projection/PartitionProjection.java
Outdated
Show resolved
Hide resolved
145fd3e to
2e4699f
Compare
pettyjamesm
left a comment
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.
Mostly looks good to me, test coverage looks good. Some code style comments / nits.
plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveMetadata.java
Outdated
Show resolved
Hide resolved
plugin/trino-hive/src/main/java/io/trino/plugin/hive/projection/PartitionProjection.java
Outdated
Show resolved
Hide resolved
plugin/trino-hive/src/main/java/io/trino/plugin/hive/projection/PartitionProjection.java
Outdated
Show resolved
Hide resolved
2e4699f to
3be16bc
Compare
3be16bc to
bf5c8a3
Compare
pettyjamesm
left a comment
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.
The changes here look good to me, thanks for taking this over the finish line @chenjian2664!
|
@pettyjamesm I really appreciate your guidance and the time you took to assist me |
|
Thanks for your work on this, @chenjian2664. I'll test it against the Backblaze B2 Bucket Access Log and let you know how it works out. |
Description
Closes #25642
This PR assumes that the underlying partition paths already follow the user-defined format, specifically for date projection.
If the projection
storage.location.templateisn't set, orstorage.location.templateis set and compatible with the Hive path -- the partition paths follow the default Hive format:partName=${partValue}. In this case,partValueis escaped for special characters (e.g., / becomes %2F), same as the existing writing logic in Hive today.If the
storage.location.templateis set, NOT compatible with the hive format, the partition value is inserted into the path that follow the template(or hive format) WITHOUT escaped special characters:• With a custom date projection format and a partition column
dtformatted asyyyy/MM/dd, this PR allows reading the partition path:dt=2015%2F10%2F10• If the
storage.location.templateis set to something like/aaa/bbb/${dt}-xxx, this PR enables reading the partition path:/aaa/bbb/2015/10/10-xxxThis PR not support writing
DateProjectionwith user-defined format that not compatible with Hive date/timestamp format.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: