Conversation
`ResultSpec::value_between` collapsed `min > max` to `nothing()`, i.e. "no value can be here". That only holds for bounds a caller derived coherently. Persist part statistics are not such a caller: arrow orders floats totally, putting `-NaN` below `-Infinity`, while `OrderedFloat`, the `Datum` order `value_between` compares in, ranks every NaN above every finite value. A part holding `-NaN` therefore reports `lower = -NaN` against a finite `upper`, the range read back as empty, and filter pushdown discarded the part, losing every other row in it. `'-NaN'` is ordinary user input, so no corrupt storage is needed to reach this. Widening unordered bounds is not sufficient on its own. A part holding NaNs of both signs records the total-order bounds `(-NaN, +NaN)`, which decode to `NaN == NaN`: a seemingly valid, non-inverted range claiming the part holds nothing but NaN, so a filter matching a finite row still discarded the part. Only the stats decode still sees the NaN signs, so `col_values` additionally refuses to produce float bounds from a negative-NaN lower, unless the upper shows the whole column is NaN. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q5GiWioZM6CWrwWgfBADDR
This was referenced Aug 7, 2026
This was referenced Aug 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Filter pushdown discarded persist parts that held rows matching the query, so the query returned too few rows.
'-NaN'is ordinary user input, so no corrupt storage is needed to reach this.Closes: PER-53
Description
Two independent causes, both fixed here.
ResultSpec::value_betweencollapsedmin > maxtonothing(), i.e. "no value can be here". That only holds for bounds a caller derived coherently, and persist part statistics are not such a caller. Arrow orders floats totally, putting-NaNbelow-Infinity, whileOrderedFloat, theDatumordervalue_betweencompares in, ranks every NaN above every finite value. A part holding-NaNtherefore reportslower = -NaNagainst a finiteupper, the range reads back as empty, and the part is discarded along with every other row in it. Unordered bounds now widen instead of collapsing.Widening alone is not sufficient. A part holding NaNs of both signs records the total-order bounds
(-NaN, +NaN), which decode underOrderedFloattoNaN == NaN, a valid-looking, non-inverted range claiming the part holds nothing but NaN. A filter that a finite row matches but NaN does not, for examplevalue = 0.0, still discarded the part. By the timevalue_betweenruns the NaN signs are erased, and(NaN, NaN)is also the honest spec of a genuinely all-NaN part, so the guard has to live in the stats decode, which still sees the sign bits.mz_repr::stats::col_valuesnow refuses to produce float bounds from a negative-NaN lower, unless the upper shows the whole column is NaN.Verification
Unit regressions for both symptoms in
persist_source.rs'sfilter_pushdown_auditmodule,negative_nan_does_not_discard_matching_partandmixed_sign_nans_do_not_discard_matching_part, each verified to fail without its half of the fix. Peek, dataflow, andEXPLAIN FILTER PUSHDOWNcases for both shapes intest/sqllogictest/explain/pushdown.slt.🤖 Generated with Claude Code