Repository navigation
fix: account for NaN in float stats exported to DuckDB and DataFusion - #10479
Conversation
Vortex's min, max and sum statistics skip NaN. Report them to DataFusion only for a column whose footer NaNCount is exactly zero, and give DuckDB a NaN max when the column holds NaN. Signed-off-by: jackylee-ch <qcsd2011@gmail.com> Signed-off-by: Robert Kruszewski <github@robertk.io>
da90c5b to
f2b1771
Compare
Merging this PR will degrade performance by 12.92%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ |
Simulation | test_scan_scalar_at[int_float] |
968.1 µs | 1,150.6 µs | -15.86% |
| ❌ | WallTime | bitpack_blocked_compress_avx2 |
6.7 µs | 7.6 µs | -11.6% |
| ❌ ℹ️ | Simulation | test_scan_filter[int] |
3 ms | 3.4 ms | -11.23% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing jackylee-ch:fix/nan-aware-float-stats (f2b1771) with develop (e8974d6)
What
Vortex's min, max and sum statistics skip NaN, but the DuckDB and DataFusion integrations report
them to the engine as exact bounds over every value. On a float column holding NaN, both engines
then answer from the statistics:
SELECT max(x)returns the largest non-NaN value instead of NaN;WHERE x = 'NaN'returns no rows (DuckDB plans anEMPTY_RESULT, DataFusion prunes the file);WHERE x < 0.5drops it as well.Fix
Check the footer's exact
NaNCount. DuckDB sorts NaN above every value, so its max becomes NaNwhen the count is non-zero and is left out when the count is unknown; min is already correct.
DataFusion sorts NaN by sign, so min, max and sum are reported only for a NaN-free column (this
also guards the v2 source, which reports no statistics yet). Other columns are unchanged; float
columns in files from before
NaNCount(0.29 to 0.32) lose their bounds.The new NaN cases fail on
develop(max(x)returns 2, the NaN filters return no rows); two planchecks pin that NaN-free float columns are still answered from statistics.
constant_distinct_count(from #10448) now reusesis_nan_free. #10265 and #9775 rewrite thesefunctions.
AI assistance
Written with agentic AI assistance; each failure above was reproduced on
developbefore the fix.