Skip to content

fix: omit zone-map stats that a nullable struct's nulls would corrupt - #10413

Merged
robert3005 merged 5 commits into
developfrom
ji/magical-bell-b84xbc
Oct 12, 2026
Merged

robert3005 merged 5 commits into
developfrom
ji/magical-bell-b84xbc

Conversation

@joseph-isaacs

Copy link
Copy Markdown
Contributor

Struct fields are written unmasked: a field still holds a value in rows where the containing struct is null, and the struct validity is written as a separate child. Each field's zone map was computed over that unmasked stream, so null_count undercounted the logical column (it was always 0 for a non-nullable field under a nullable struct) and nan_count counted values the column never shows. Pruning on s.x IS NULL then discarded zones that held matching rows.

Add LayoutWriterContext::with_nullable_ancestor, set by StructStrategy on the context it hands to field writers of a nullable struct, and have ZonedStrategy keep only min/max style aggregates under it. Those remain sound as bounds because the unmasked field is a superset of the logical values. Count aggregates are omitted rather than recorded wrong until they can be computed over the masked values.

Claude-Session: https://claude.ai/code/session_01HRQvL72sLkXczGCjvFWaMG

Summary

  • Tracking Issue: #000

Changes

joseph-isaacs and others added 2 commits October 9, 2026 12:58
Struct fields are written unmasked: a field still holds a value in rows
where the containing struct is null, and the struct validity is written
as a separate child. Each field's zone map was computed over that
unmasked stream, so null_count undercounted the logical column (it was
always 0 for a non-nullable field under a nullable struct) and nan_count
counted values the column never shows. Pruning on `s.x IS NULL` then
discarded zones that held matching rows.

Add `LayoutWriterContext::with_nullable_ancestor`, set by
`StructStrategy` on the context it hands to field writers of a nullable
struct, and have `ZonedStrategy` keep only min/max style aggregates
under it. Those remain sound as bounds because the unmasked field is a
superset of the logical values. Count aggregates are omitted rather
than recorded wrong until they can be computed over the masked values.

Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HRQvL72sLkXczGCjvFWaMG
Pin down that the flag set by a nullable struct reaches leaves below
any number of non-nullable struct levels, is not set above the nullable
level, and leaves sibling leaves untouched.

Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HRQvL72sLkXczGCjvFWaMG
@codspeed

codspeed Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Merging this PR will regress 1 benchmark

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚠️ 1 benchmark measured no execution time

Nothing ran under measurement, usually because the compiler removed the code under test. This result is not comparable, so it counts as unchanged.

Preventing compiler optimizations

⚠️ 6 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

⚡ 5 improved benchmarks
❌ 1 regressed benchmark
✅ 2201 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ WallTime bitpack_blocked_compress_avx512 4.9 µs 5.7 µs -13.94%
⚡ WallTime threshold_neon[8] 4 µs 3 µs +33.84%
⚡ WallTime filter_neon[64] 3.5 µs 2.9 µs +19.76%
⚡ WallTime threshold_neon[80] 5.8 µs 4.8 µs +19.15%
⚡ WallTime threshold_neon[64] 5.3 µs 4.5 µs +18.52%
⚡ WallTime filter_neon[80] 3.5 µs 3.2 µs +11.25%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing ji/magical-bell-b84xbc (d00d4e2) with develop (9d5a844)

Open in CodSpeed

@robert3005 robert3005 added the changelog/fix A bug fix label Oct 9, 2026
Zone maps hold exact values. Min and max over an unmasked field are
sound bounds for the logical column but can be wider than its true
range, because rows the struct nulls out still hold a value. Rather
than keep them as inexact bounds, skip the zone map entirely for such
fields and write the data child alone, until the aggregates are
computed over the masked values.

Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HRQvL72sLkXczGCjvFWaMG
@joseph-isaacs
joseph-isaacs marked this pull request as ready for review October 12, 2026 13:06
joseph-isaacs and others added 2 commits October 12, 2026 13:11
The context carries tree-position facts such as permitted aggregates
and the nullable-ancestor flag, which reach a child only because its
parent forwarded them. Say so on the trait so a strategy that builds a
fresh context is caught in review.

Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HRQvL72sLkXczGCjvFWaMG
Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HRQvL72sLkXczGCjvFWaMG
@robert3005
robert3005 merged commit 644fbcd into develop Oct 12, 2026
89 of 90 checks passed
@robert3005
robert3005 deleted the ji/magical-bell-b84xbc branch October 12, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants