Repository navigation
Conversation
Export Paimon value and metadata buffers using struct validity for SQL NULL. Preserve encoded variant nulls and scalar types in top-level and nested values, and reject incomplete payloads. Co-Authored-By: Codex <noreply@openai.com> AI-Model: gpt-6 AI-Contributed/Feature: 611/611 AI-Contributed/UT: 0/0
JingsongLi
left a comment
There was a problem hiding this comment.
I verified the C read end to end on a Parquet table. The base read exposed an empty payload pair and encoded Variant null as two valid structs. This head sets SQL NULL validity for the empty pair and preserves the encoded null. All 113 C tests passed. Two additional nested cases reproduced the gaps below. A fixture from the affected Java writer would also document which legacy output needs this conversion.
| .fields() | ||
| .iter() | ||
| .any(|field| contains_variant(field.data_type())), | ||
| _ => false, |
There was a problem hiding this comment.
[P2] Normalize VARIANT nested inside MULTISET elements. Paimon's Arrow mapping stores a multiset as a map whose key is the element type. I wrote and read a Parquet table with MULTISET<ROW<v VARIANT>> through the C API. The empty-pair SQL NULL and the encoded Variant null both came back valid inside the key. Recurse through the multiset key, leaving the count unchanged.
| .downcast_ref::<ListArray>() | ||
| .ok_or_else(|| invalid_array(path, "ListArray", array.data_type()))?; | ||
| let values = canonicalize_variants( | ||
| input.values(), |
There was a problem hiding this comment.
[P2] Limit ARRAY and MAP normalization to entries visible in the current batch. Arrow slices keep their backing child arrays, and merged Data Evolution reads emit slices of source columns. A two-row ListArray with an incomplete Variant only in the second row failed normalization when I passed a slice containing just the valid first row. Use the active offsets and parent validity when traversing children, like Core's nested evolution logic. This also avoids revalidating the full source array for each emitted slice.
Purpose
Closes #1517.
Preserve the bytes and scalar types of valid VARIANT values across the Arrow C interface, and make SQL NULL distinguishable from an encoded variant null.
Brief change log
Tests
Added Arrow C Data round-trip cases, non-JSON scalar types, sliced SQL and variant nulls, incomplete payloads, nested values, ordinary rows and empty batches.
Local verification passed with
cargo build --locked -p paimon-c --libandcargo fmt --all -- --check. Test execution is left to upstream CI.API and Format
The existing Arrow C read returns a struct with binary
valueandmetadatachildren and uses the outer validity bitmap for SQL NULL.Documentation
The C binding guide describes the payload fields and null representation.