Uh oh!
There was an error while loading. Please reload this page.
GH-3406: fix Float16 statistics handling for NaN and zero values - #3407
Conversation
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
Fixes Float16 min/max edge cases so statistics and column indexes behave correctly when encountering NaN and signed-zero values, aligning behavior with Float/Double semantics and preventing invalid column indexes from being produced.
Changes:
- Add shared
Float16Binaryconstants for +0/-0 and reuse them in statistics/index logic. - Normalize Float16 min/max for signed zero and invalidate Float16 column indexes when NaN is present.
- Update/extend Hadoop round-trip tests to cover signed-zero normalization and NaN column-index invalidation.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| parquet-hadoop/src/test/java/org/apache/parquet/statistics/TestFloat16Statistics.java | Updates expected min/max placeholders for NaN stats handling. |
| parquet-hadoop/src/test/java/org/apache/parquet/statistics/TestFloat16ReadWriteRoundTrip.java | Adjusts zero-related expectations and adds a NaN column-index test expecting no index. |
| parquet-column/src/main/java/org/apache/parquet/schema/Float16.java | Introduces shared +0/-0 Float16 Binary constants. |
| parquet-column/src/main/java/org/apache/parquet/internal/column/columnindex/BinaryColumnIndexBuilder.java | Adds Float16-specific normalization (+0/-0) and NaN invalidation for column index creation. |
| parquet-column/src/main/java/org/apache/parquet/column/statistics/Statistics.java | Reuses Float16 constants and aligns NaN placeholder behavior with float/double builders. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
3809385 to
b42fcfbCompareHuaHuaY
commented
Feb 27, 2026
Please take a look again @wgtmac |
wgtmac
commented
Feb 27, 2026
@gszadovszky Could you help review this as well? I think this fix makes a lot of sense to be consistent with what currently float and double types do. |
wgtmac
commented
Mar 4, 2026
Thanks @HuaHuaY for fixing this and @gszadovszky for the review! |
Uh oh!
There was an error while loading. Please reload this page.
Rationale for this change
What changes are included in this PR?
Statistics<>.Float16BuilderandBinaryColumnIndexBuilder, this PR will adjust value when the min or max value is +0 or -0.BinaryColumnIndexBuilder, this PR will mark the column index is invalid when the min or max value is NaN.Statistics<>.Float16Builder, statistic will be changed to (+0.0, +0.0) which is the same behavior asDouble.Are these changes tested?
Yes.
Are there any user-facing changes?
Yes. This PR corrects the behavior about
Float16.Closes#3406