Repository navigation
Keep the file sum absent when a chunk sum overflows - #10328
Conversation
The file writer sums a nullable column of per-chunk sums. A chunk sum is null only when that chunk overflowed, and the outer sum skipped those nulls, so the footer could report an exact sum of just the chunks that did not overflow. For chunks `[i64::MAX, 1]` and `[2]` the footer reported 2. Leave the file sum absent when any chunk sum is null, matching the existing guard for truncated varlen maxima. Claude-Session: https://claude.ai/code/session_014jTJihcDfBHCS9AQcQHLjR Signed-off-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014jTJihcDfBHCS9AQcQHLjR Signed-off-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014jTJihcDfBHCS9AQcQHLjR Signed-off-by: Claude <noreply@anthropic.com>
Merging this PR will degrade performance by 25.65%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | new_bp_prim_test_between[i64, 2048] |
96.9 µs | 130.3 µs | -25.65% |
| Simulation | density_sweep_dense_runs[0.9] |
52.8 µs | < 1 ns | N/A | |
| Simulation | bench_compare_sliced_dict_primitive[(3333, 10000)] |
77.9 µs | < 1 ns | N/A |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing ct/determined-noether-n06jvq (eccd65d) with develop (5cfc0b5)
Footnotes
-
518 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
Summary
The file writer computes the file
Stat::Sumin two passes.push_chunkstores each chunk's sum in a nullable column, andas_stats_setsums that column again. Both passes use the legacySumaggregate, which returns zero for empty input and null only on overflow. The second pass skips nulls as if they were missing values, so the footer could report an exact sum of only the chunks that did not overflow. For chunks[i64::MAX, 1]and[2], the footer reported2.This happens with real data when some chunks overflow and others don't. Examples: microsecond timestamps stored as plain
i64, where full batches overflow but a short last batch does not, ori64::MAX/u64::MAXsentinel values that only appear in some chunks.This replaces #10228 with a much smaller fix.
Changes
StatsAccumulator::as_stats_set, leaveSumabsent when any chunk sum is null. This follows the existing guard for truncated varlenMaxright above it.vortex-layout(one chunk overflows, all chunks overflow, the total overflows, nullable values, an all-null chunk) and an end-to-end writer test invortex-filethat checks both the returned footer and the footer read back from the file.This is a stopgap for the legacy
Stat::Sumpath only. When file statistics move to aggregate function partials (for exampleSumV2, which tracks overflow in an explicitis_overflowfield), chunk results are merged as partials instead of summed as values, and this guard can be deleted along withStat::Sum.🤖 Generated with Claude Code
https://claude.ai/code/session_014jTJihcDfBHCS9AQcQHLjR