Skip to content

fix(writer): the root node of a flat segment carries the array stats Rust keeps - #673

Merged
dfa1 merged 1 commit into
mainfrom
feat/583-node-stats-parity
Nov 6, 2026
Merged

dfa1 merged 1 commit into
mainfrom
feat/583-node-stats-parity

Conversation

@dfa1

@dfa1 dfa1 commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Refs #583 (PR 1 of 3; does not close it). Parity with Rust is the target, so Java-only extras are dropped.

Rust's flat layout computes no stats; it keeps what the compressor had cached on the array (flat/writer.rs), and each encoding passes on only some (vortex-compressor/src/stats/*, compressor/cascade.rs). Java wrote min, max and null_count on every root. Now the root node carries:

root stats
integer under vortex.primitive / fastlanes.bitpacked min, max, is_constant (only without nulls), null_count, uncompressed_size_in_bytes
float under vortex.primitive is_constant (only without nulls), null_count, uncompressed_size_in_bytes
bool is_constant, uncompressed_size_in_bytes
anything else (alp, alprd, fsst, onpair, constant, for, dict, strings, ...) none

EncodeNode gains a NodeStats, written for every node by buildArrayNodeFlatBuffer.

Consequence (intended). A Java-written string column has no flat min/max, as a Rust-written one has none, so columnStats() reports none for it; the zoned layout's stats table still holds string bounds in both. Three tests that read string bounds from flat stats now expect none (globalDict_utf8_reportsColumnStats, filteredUtf8_prunesOnTruncatedBounds, the global-dict inspector profile), and utf8ChunkStats_inUtf8ByteOrder now prunes against the zone map. The reader does not decode decimal bounds from the zone table, so those bounds are unreadable for Rust-written files too.

Test. NodeStatsInteropIntegrationTest writes the same rows (sorted/random/small ints, floats, low/high-cardinality strings, bool, nullable int) through vortex-jni and Java and compares the root line of every flat segment, stats and values included (zone tables too). vortex.sequence is compared by id until its sorted flags land. RootNodeStatsTest pins the rules. Full ./mvnw verify passes, and so do the slow-tagged integration classes.

Still to do for #583: child-node stats (PR 2: sequence flags, ALP/FSST/bitpacked children, validity), and the zone-table segments' shape (PR 3).

🤖 Generated with Claude Code

…Rust keeps (#583)

Rust's flat layout computes no stats; it keeps what the compressor had cached on
the array, and each encoding passes on only some. Java wrote min, max and
null_count on every root. Now an integer root under vortex.primitive or
fastlanes.bitpacked carries min, max, is_constant (only without nulls),
null_count and the uncompressed size, a float root the flag, count and size, a
bool root the flag and size, and every other encoding none.

As in a Rust-written file, a string column then has no flat min/max, so
columnStats() reports none for it.

Child nodes and vortex.sequence's sorted flags are still to do.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011fRbYsrGtpKHp9APhU8qDV
@dfa1
dfa1 merged commit 1a51bfa into main Nov 6, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant