Parquet: Handle signed zero consistently in dictionary row-group filtering
Apache Iceberg version
None
Query engine
None
Please describe the bug 🐞
Bug description
ParquetDictionaryRowGroupFilter may incorrectly exclude row groups when evaluating predicates involving positive and negative floating-point zero.
Apache Iceberg's expression semantics treat -0.0 and +0.0 as equivalent for float and double predicate comparisons. However, the dictionary-filter implementation uses the literal comparator for equality, inequality, and dictionary membership checks.
Because Java's floating-point comparison ordering distinguishes the two signed-zero representations, this can produce incorrect filtering decisions.
Example scenario
Consider a Parquet row group where a dictionary-encoded float or double column contains -0.0.
A query predicate such as:
x = 0.0
should match rows containing -0.0.
However, when the dictionary filter evaluates the predicate using the default comparator, it may conclude that the dictionary does not contain a matching value and incorrectly skip the row group.
Expected behavior
-0.0and+0.0should compare as equivalent for Iceberg float and double predicates.- Dictionary filtering must not incorrectly prune row groups containing matching values.
- Equality, inequality, range comparisons, and set predicates should follow Iceberg's expression semantics.
Proposed investigation and fix
- Inspect signed-zero comparisons in
ParquetDictionaryRowGroupFilter, particularly equality, inequality, and range predicates. - Reuse the signed-zero-aware comparison semantics introduced in PR #18813 where appropriate, without adding an unnecessary cross-module dependency.
- Add regression tests using dictionary-encoded float and double values, covering both signed-zero directions.
- Verify that predicate evaluation never incorrectly excludes a row group containing a matching value.
Related references
- Issue #18723 — Signed-zero predicate-evaluation bug.
- PR #18813 — API predicate-evaluation fix.
- Discussion: https://github.com/apache/iceberg/pull/18813#issuecomment-6711400628
CC @Rishavbhattarai — thank you for identifying this additional case and offering to help test the follow-up.
This issue tracks the Parquet dictionary-filter investigation separately so that PR #18813 can remain focused on API predicate-evaluation correctness.
Willingness to contribute
- [ ] I can contribute a fix for this bug independently
- [ ] I would be willing to contribute a fix for this bug with guidance from the Iceberg community
- [ ] I cannot contribute a fix for this bug at this time
Hi everyone,
I'd like to take this issue and work on the fix.
I'm currently contributing to the related signed-zero predicate-evaluation fix in PR #18813, and I'll investigate the corresponding behavior in ParquetDictionaryRowGroupFilter as a separate follow-up.
My plan is to:
- Reproduce the suspected signed-zero dictionary-filtering issue using focused regression tests.
- Investigate equality, inequality, range, and set predicate behavior for
FLOATandDOUBLE. - Implement a targeted fix consistent with Iceberg's signed-zero comparison semantics.
- Run the relevant Parquet module tests and submit a PR referencing this issue.
@Rishavbhattarai, thank you for offering to help test this follow-up. I'd appreciate your feedback once I have a reproducible test case or initial patch.
I'll take ownership of the investigation and proposed fix and post updates here as work progresses.
Thanks!