fix(arrow): read null values from a FixedSizeList Parquet column - #2
Draft
ChaomingZhangCN wants to merge 1 commit into
Draft
fix(arrow): read null values from a FixedSizeList Parquet column#2ChaomingZhangCN wants to merge 1 commit into
ChaomingZhangCN wants to merge 1 commit into
Conversation
A VECTOR column written by an engine that stores the Arrow schema, such as Paimon Rust or Python, is read back as FixedSizeList. Parquet stores a null list slot without any value, while `FixedSizeListReader::AssembleArray` requires every slot to span exactly `list_size` values, so reading such a file failed with "Expected all lists to be of size=3 but index 2 had size=0". Backport the upstream fix (apache/arrow GH-50271): walk the validity runs and rebuild the child array, materializing `list_size` null values for every null slot, and reject a null slot that does carry values. `ListReader` members become protected so the subclass can reach the memory pool. Turn ParquetVectorIoTest.ReadNullableRustFixtureIsUnsupported, which pinned the old failure, into a read check. Co-authored-by: 小明同学 <ChaomingZhangCN@users.noreply.github.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.
Purpose
Follow-up to the VECTOR work in apache/paimon-cpp#198, kept separate because it changes the bundled Arrow build rather than Paimon code. It is based on
codex/vector-parquet-mvp, so it can only merge after that branch lands.A VECTOR column written by an engine that stores the Arrow schema, such as Paimon Rust or Python, is read back as Arrow
FixedSizeList. Parquet stores a null list slot without any value, while Arrow 17'sFixedSizeListReader::AssembleArrayrequires every slot, including a null one, to span exactlylist_sizevalues. Reading such a file therefore failed with:There is no way to avoid this from the Paimon side: the reader materializes the column per the Arrow schema stored in the file, and
parquet::FileMetaDataexposes its key-value metadata read-only, so the storedFixedSizeListtype cannot be bypassed.This change backports the upstream fix (apache/arrow GH-50271) into
cmake_modules/arrow.diff, which the project already uses to patchcpp/src/parquet/arrow/reader.cc:list_sizenull child values per slot, so the fixed-size layout is restored.list_sizevalues, a null slot must span none.ListReadermembers becomeprotectedsoFixedSizeListReadercan reach the memory pool. The upstream code usesstd::span, which is rewritten with plain pointer arithmetic to stay C++17.Tests
ParquetVectorIoTest.ReadNullableRustFixtureIsUnsupported, which pinned the old failure against therust_vector_nullable.parquetfixture (arrow-rs 58.4.0,FixedSizeList<Float32, 3>with a null vector), becomesReadNullableRustFixtureand now checks the values that are read back.Validation, all against the patched Arrow:
The patch was also verified to apply to a pristine
apache-arrow-17.0.0tree withpatch -s -N -p1and to reproduce exactly the source that these runs were built from.API and Format
API: No.
Schema protocol: No.
Storage format: No. Paimon C++ still writes VECTOR as a standard Parquet LIST; only the read path for files that record the column as
FixedSizeListchanges.Documentation
The VECTOR section of
docs/source/user_guide/data_types.rstno longer needs to warn that aFixedSizeListfile with NULL vectors cannot be read, and the fixture notes record what the patch does.Generative AI tooling
Generated-by: Cursor Cloud Agent (Claude Opus 5)