Skip to content

fix(parquet): address VECTOR review feedback on nested reads and shared helpers - #1

Merged
cursor[bot] merged 4 commits into
codex/vector-parquet-mvpfrom
cursor/vector-review-fixes-c3af
Aug 17, 2026
Merged

fix(parquet): address VECTOR review feedback on nested reads and shared helpers#1
cursor[bot] merged 4 commits into
codex/vector-parquet-mvpfrom
cursor/vector-review-fixes-c3af

Conversation

@ChaomingZhangCN

Copy link
Copy Markdown
Owner

Purpose

Follow-up to the review feedback on apache/paimon-cpp#198 (VECTOR Parquet storage). It targets codex/vector-parquet-mvp so the PR branch can absorb the changes.

Addressed review points:

  • ContainsVectorType / ContainsVectorField / ValidateVectorElements were duplicated in schema validation, the Parquet write converter and the VECTOR read wrapper. They now live in one place, VectorUtils (src/paimon/common/utils/arrow/vector_utils.{h,cpp}).
  • The VECTOR element scan could read past the end of the values array. Arrow's C data interface importer does not check that a FixedSizeList child holds length * list_size values, so a caller passing a short child made the write-path nullability check index past the child's validity bitmap. VectorUtils::ValidateVectorElements now rejects that layout before scanning.
  • HasSameNestedProjectionShape, CollectLeafIndices and SkipLeafIndices in the Parquet reader had no FIXED_SIZE_LIST branch, so reading a file that stores VECTOR as Arrow FixedSizeList (Paimon Rust and Python writers) failed with "partial projection inside list/map" when the vector was nested in a LIST, and a vector column was otherwise treated as a leaf.
  • FieldMappingBuilder::CreateDataCastExecutors now exempts FIXED_SIZE_LIST from the scalar cast lookup, like the other nested types.
  • NormalizeRecordBatchOffsets had no FIXED_SIZE_LIST branch, so sliced VECTOR columns were fully copied instead of having their buffers sliced.
  • Rebuilding a nested type for VECTOR reads and writes no longer drops the name and metadata of a MAP entries field.
  • Nits: needs_vector_conversion moved before the memory pool in the ParquetFormatWriter constructor, VECTOR test arrays built from JSON instead of Arrow builders, and the license header removed from the fixture notes.

Tests

  • New src/paimon/common/utils/arrow/vector_utils_test.cpp: helper detection across nested types, null-element rejection for both LIST and FixedSizeList VECTOR values, slice handling, and the truncated-child layout.
  • arrow_utils_test.cpp: regression test that the write-path nullability check rejects a FixedSizeList whose child is shorter than the declared dimension, plus a fixed_size_list case in the offset-normalization matrix so the zero-copy assertions cover it.
  • parquet_vector_io_test.cpp: reading list<fixed_size_list<float, 3>> from a file written by the plain Arrow Parquet writer (the Rust/Python physical layout), and an end-to-end read with a predicate pushed down on a non-vector column next to a VECTOR column.

Validation status: the workspace had no configured build, so a Debug build with PAIMON_BUILD_TESTS=ON was configured from scratch (-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++, since /usr/bin/c++ is a Clang that cannot link libstdc++ here). All third-party dependencies are bundled, so paimon-common-test, paimon-core-test and paimon-parquet-format-test are still building Arrow/Parquet/ORC from source on this 4-core VM. Test results will be reported once the build finishes.

API and Format

API: No change beyond PR apache#198. VectorUtils is an internal helper under src/paimon/common/utils/arrow/.

Schema protocol: No.

Storage format: No. VECTOR is still persisted as a standard Parquet LIST; the reader change only widens which physical layouts can be read back.

Documentation

No new documentation. The VECTOR section added by PR apache#198 already records the append-only Parquet-only scope.

Generative AI tooling

Generated-by: Cursor Cloud Agent (Claude Opus 5)

Open in Web Open in Cursor 

cursoragent and others added 4 commits August 17, 2026 12:10
`ContainsVectorType`, `ContainsVectorField` and `ValidateVectorElements` were
duplicated across schema validation, the Parquet write path and the VECTOR read
wrapper. Move them into `VectorUtils` and let every caller share one
implementation.

While validating a FixedSizeList, also reject a VECTOR whose child does not hold
`length * list_size` values. Arrow does not verify this when importing an array
over the C data interface, so the element scan reading the child validity bitmap
could run past its end on the write path.

Keep the name and metadata of a MAP entries field when rebuilding a nested type
for reads and writes, instead of falling back to Arrow's defaults.

Co-authored-by: 小明同学 <ChaomingZhangCN@users.noreply.github.com>
`NormalizeRecordBatchOffsets` had no FixedSizeList branch, so every sliced VECTOR
column fell back to a full copy of its values. Slice the child instead, the way
the list and struct layouts already do, since a contiguous slice of the parent
always spans a contiguous range of the child.

Co-authored-by: 小明同学 <ChaomingZhangCN@users.noreply.github.com>
A file written by Paimon Rust or Python exposes a VECTOR column as Arrow
FixedSizeList, so the read schema handed to the Parquet plugin keeps that type
too. `HasSameNestedProjectionShape` had no FixedSizeList branch and rejected such
a schema as a partial projection inside list/map, and `CollectLeafIndices` and
`SkipLeafIndices` treated a FixedSizeList as a leaf column.

`FieldMappingBuilder::CreateDataCastExecutors` also has to exempt FixedSizeList
from the scalar cast lookup, like the other nested types, because the reader
reshapes those columns itself.

Co-authored-by: 小明同学 <ChaomingZhangCN@users.noreply.github.com>
Move the `needs_vector_conversion` writer parameter before the memory pool,
build VECTOR test arrays from JSON instead of Arrow builders, and drop the
license header from the VECTOR fixture notes.

Co-authored-by: 小明同学 <ChaomingZhangCN@users.noreply.github.com>
@cursor
cursor Bot merged commit 6c1235d into codex/vector-parquet-mvp Aug 17, 2026
@cursor
cursor Bot deleted the cursor/vector-review-fixes-c3af branch August 17, 2026 12:25
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.

2 participants