iceberg icon indicating copy to clipboard operation
iceberg copied to clipboard

Parquet: Handle signed zero consistently in dictionary row-group filtering

Open adiranjan25 opened this issue 3 weeks ago • 1 comments

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.0 and +0.0 should 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

  1. Inspect signed-zero comparisons in ParquetDictionaryRowGroupFilter, particularly equality, inequality, and range predicates.
  2. Reuse the signed-zero-aware comparison semantics introduced in PR #18813 where appropriate, without adding an unnecessary cross-module dependency.
  3. Add regression tests using dictionary-encoded float and double values, covering both signed-zero directions.
  4. 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

adiranjan25 avatar Nov 11 '26 05:11 adiranjan25

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:

  1. Reproduce the suspected signed-zero dictionary-filtering issue using focused regression tests.
  2. Investigate equality, inequality, range, and set predicate behavior for FLOAT and DOUBLE.
  3. Implement a targeted fix consistent with Iceberg's signed-zero comparison semantics.
  4. 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!

adiranjan25 avatar Nov 11 '26 05:11 adiranjan25