feat(zstd): encode nullable columns#167
Merged
Merged
Conversation
ZstdEncodingEncoder had no null handling: only fully-valid primitive and varbin columns could be written, while the reader already decoded nullable vortex.zstd (validity child[0] + a packed valid-only payload). Close the asymmetry. The encoder now accepts NullableData (primitive) and String[] carrying nulls (utf8/binary): null positions are stripped so only valid values reach the compressed frame, and the validity bitmap is encoded as a Bool child[0] — mirroring the Rust reference. Adds encode->decode round-trip tests for both shapes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Route NullableData straight to a configured nullable-capable encoder (EncodingEncoder.acceptsNullable) instead of always masked-wrapping, so an explicitly-configured vortex.zstd encodes nullable primitive columns directly (validity as Bool child[0]). Default writes are unaffected: DEFAULT_CODECS has no zstd, and the cascade path keeps the masked layout. Reject non-nullable utf8/binary carrying a stray null rather than silently emitting a nullable layout. Nullable varbin stays data-driven (validity child only when nulls are present), matching the Rust ref. Add Rust-interop ITs for nullable zstd (primitive I64 + utf8) and unit tests for the all-null payload corner and the non-nullable-with-null guard. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Summary
Closes the
vortex.zstdnullable encode gap (TODO.md). The reader already decoded nullablevortex.zstd(validitychild[0]+ a packed valid-only payload, scattered on decode), butZstdEncodingEncodercould only write fully-valid primitive and varbin columns.What changed
ZstdEncodingEncoder—encode(...)now accepts:NullableData(primitive nullable): strips null positions from the storage array, compresses only the valid values.String[]carrying nulls (utf8/binary nullable): strips nulls, compresses only the valid strings.In both cases the validity bitmap is encoded as a Bool
child[0](buffer indices remapped by 1, frame payload ownsbuffer[0]). Mirrors the Rust reference: only valid values reach the compressed payload.encode_nullablePrimitive_roundTrips+encode_nullableUtf8_roundTrips(encode → decode → assert values + validity).Addedentry.Testing
ZstdEncodingEncoderTestpass (incl. 2 new round-trips)../mvnw -q test -pl writer -am -Dtest=ZstdEncodingEncoderTestNotes
vortex.zstdTODO item) is still open.🤖 Generated with Claude Code