fix(writer): unify nullable utf8/binary on the NullableData carrier#168
Merged
Conversation
Nullable utf8/binary columns now flow through the same NullableData carrier as nullable primitives instead of a String[] with inline nulls. ChunkImpl derives the validity bitmap, the writer routes the column through MaskedEncoding (or a nullable-capable encoder such as vortex.zstd), and VarBin treats a null element as a zero-length slot. Fixes two latent bugs the old String[]-with-nulls path hid: - default-path nullable utf8 write threw NullPointerException in VarBin - nullable utf8 with no nulls in the scanned rows decoded as a bare VarBinArray, silently dropping null information; it now decodes as a MaskedArray (validity + values child) like nullable primitives. CsvExporter now handles MaskedArray (null row -> empty field), so nullable columns export instead of failing with "unsupported array type". Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
58407c5 to
e18948b
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.
Summary
Follow-up to #167. Tackles the nullable-input shape asymmetry (utf8 used
String[]-with-nulls, primitives usedNullableData) by unifying on theNullableDatacarrier — and fixes two latent bugs that asymmetry was hiding.What changed
ChunkImpl— nullableUtf8/Binarynow producesNullableData(String[]-with-nulls, validity), like nullable primitives.VarBinEncodingEncoder— a null element encodes as a zero-length slot (masked values child), no more NPE; stats already skip null.ZstdEncodingEncoder— consumesNullableDatafor utf8/binary;acceptsNullablecovers them.CsvExporter— handlesMaskedArray(null row → empty field).Latent bugs fixed
NullPointerExceptionin VarBin.VarBinArray, silently dropping null info; now consistentlyMaskedArray.Behavior change
Nullable utf8/binary now always decode as
MaskedArray(validity + values child), consistent with nullable primitives. Tests updated (parquet importer, parquet import IT).Testing
javaWriter_rustReader_masked_nullableUtf8(Rust reads a Java-written nullable utf8 file) and the existing zstd-nullable ITs.🤖 Generated with Claude Code