feat(writer): emit vortex.stats zone-maps (ADR 0017)#121
Merged
Conversation
Honour WriteOptions.enableZoneMaps (previously a no-op): for every fixed-width primitive column whose chunks all carry min/max stats, wrap the data layout in a vortex.stats layout with a per-zone (per-chunk) stats-table child holding MAX/MIN. Metadata is u32 zone_len + the Rust Stat bitset, matching what the reader/inspector already decode for Rust-written files. Per-chunk min/max come from EncodeResult; the stats table is a struct array (nullable max/min + *_is_truncated flags) encoded via the struct encoder, which now routes nullable fields through the masked encoder. Java write -> read round-trip verifies per-zone min/max; existing zone-map pruning and 1573 writer/reader tests stay green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
c237a1d to
9ab2176
Compare
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.
What
Honours
WriteOptions.enableZoneMaps(previously a no-op flag): the writer now emitsvortex.stats(zoned) layouts for fixed-width primitive columns — per-zone (per-chunk) MAX/MIN — matching the wire format the reader and inspector already decode for Rust-written files.Surfaced while raising
VortexInspectorTuicoverage: the per-chunk-stats pane looked dead, but it's live for Rust files (TPCH/clickbench usevortex.zonedheavily) — the gap was the missing writer capability.How
EncodeResult(already computed); captured intoChunkRef.flushZoneMaps()(before the footer) builds a per-zone stats-table struct array ([max, max_is_truncated, min, min_is_truncated], nullable min/max) and encodes it as the zoned layout's second child; metadata =u32 zone_len+ RustStatbitset (MAX|MIN).StructEncodingEncodernow routes nullable fields through the masked encoder (prerequisite).vortex.statslayout spec; ineligible columns (varbin/bool/dict/extension/F16) emit unchanged.Wire format read from the Rust reference
vortex-layout/src/layouts/zoned/{mod,schema}.rs; rationale captured in the code comments (no ADR — fixed external format, no architecture decision to record).Verification
WriterZoneMapTest: Java write → read round-trip decodes per-zone min/max via the same path the inspector uses for Rust files; flag on/off honoured; data round-trips.ZoneMapPruningTest+ 1573 writer/reader and 156 inspector/cli tests stay green.Follow-ups (not in this PR)
JavaWritesRustReadsinterop test (ground truth that Rust reads Java-writtenvortex.stats) — needs the JNI/Rust env.🤖 Generated with Claude Code