Uh oh!
There was an error while loading. Please reload this page.
GH-3242: Emit and Read min/max statistics for int96 timestamp columns - #3243
GH-3242: Emit and Read min/max statistics for int96 timestamp columns#3243rahulketch wants to merge 15 commits into
Conversation
emkornfield
commented
Jun 13, 2025
It looks like Alkis started a discussion on the ML, but we probably want to come to a consensus and update https://github.com/apache/parquet-format/blob/master/src/main/thrift/parquet.thrift#L1079 first before merging this. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
rahulketch
commented
Jun 25, 2025
@emkornfield : I created the PR: apache/parquet-format#503 |
rahulketch
commented
Jul 1, 2025
After this change, |
rahulketch
commented
Jul 23, 2025
@emkornfield@rdblue Given the latest message in the mailing thread, can we merge this? If so, could you help me with addressing this issue |
emkornfield
commented
Jul 23, 2025
Sorry I'm not sure on the API change. Lets get (lazy) consensus on the message for this direction. I think @rdblue had the strongest opinion on SortOrder |
rahulketch
commented
Jul 24, 2025
@wgtmac : could you help with this? |
rahulketch
commented
Sep 3, 2025
@wgtmac : Could you help with this, or suggest who could help out? Thanks! |
wgtmac
commented
Sep 5, 2025
@rahulketch Sorry I'm too busy these days. Perhaps I can find some time next week. |
Uh oh!
There was an error while loading. Please reload this page.
| static final PrimitiveComparator<Binary> BINARY_AS_INT96_TIMESTAMP_COMPARATOR = new BinaryComparator() { | ||
| @Override | ||
| int compareBinary(Binary b1, Binary b2) { | ||
| ByteBuffer bb1 = b1.toByteBuffer().slice(); |
There was a problem hiding this comment.
Should we check if their lengths are exactly 12 before anything? I recall that BINARY_AS_FLOAT16_COMPARATOR did this.
Uh oh!
There was an error while loading. Please reload this page.
| try { | ||
| ParsedVersion version = VersionParser.parse(createdBy); | ||
| if ("parquet-mr".equals(version.application)) { |
There was a problem hiding this comment.
I recall that @rdblue has an opinion in maintaining an allow-list here.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| public static Statistics toParquetStatistics(org.apache.parquet.column.statistics.Statistics stats) { | ||
| return toParquetStatistics(stats, ParquetProperties.DEFAULT_STATISTICS_TRUNCATE_LENGTH); | ||
| public Statistics toParquetStatistics(String createdBy, org.apache.parquet.column.statistics.Statistics stats) { |
There was a problem hiding this comment.
I am not sure of a better way to achieve this. We need to:
- Know created-by in order to have an allow-list for valid readers
- Make the function non-static so we can respect the flag which disables reading the stats.
Any ideas for this?
There was a problem hiding this comment.
Should we just follow the existing pattern of toParquetStatistics to introduce yet another overload?
public static Statistics toParquetStatistics(
org.apache.parquet.column.statistics.Statistics stats, int truncateLength, bool convertInt96Stats)
@gszadovszky WDYT?
There was a problem hiding this comment.
I agree with @wgtmac.
Or, we can deprecate the static methods (marking them for removal in 2.0) and create non-static ones to be used from now on.
…veComparator.java Co-authored-by: Gang Wu <ustcwg@gmail.com>
…s.java Co-authored-by: Gang Wu <ustcwg@gmail.com>
b107ae8 to
90656f1CompareThis pull request has been automatically marked as stale because it has had no activity for at least 2 months. If you are still working on this change or plan to move it forward, please leave a comment or push a new commit so we know to keep it open. Otherwise, this PR will be closed automatically in about one month. Thank you for your contribution to Apache Parquet! |
Closing this pull request due to at least 3 months of inactivity. If you would like to continue the work, please feel free to reopen this pull request or open a new one. Thank you for your contribution to Apache Parquet! |
…ParquetStatistics Address PR feedback (gszadovszky, wgtmac on apache#3243): keep the previously-public static methods as @deprecated shims that delegate to a default ParquetMetadataConverter instance, so 1.x callers still compile. The new createdBy-aware non-static methods remain the recommended path.
Rationale for this change
Parquet-java does not emit or read stats for int96 timestamp columns. Since int96 is used as the default timestamp in spark, this limits a lot of optimization opportunities. Engines like Photon populate the statistics for the int96 timestamps correctly. So parquet-java can also emit the statistics, and also allow reading these statistics from known good writers.
What changes are included in this PR?
parquet.read.int96stats.enabledto control if the stats are read. It is defaulted to trueValidInt96Stats: Reads stats from known good writers. Currently including:a.
parquet-mr 1.15.0+b.
photonAre these changes tested?
Are there any user-facing changes?
toParquetStatisticsandfromParquetStatisticsare no longer static functions. It doesn't look like there is a good reason for these functions to be static.ParquetMetadataConverteris now different due to an added parameter.Closes#3242