Skip to content

fix(encoding): preserve special slots when recording validity - #9268

Merged
Xuanwo merged 1 commit into
mainfrom
xuanwo/repdef-nested-validity
Sep 16, 2026
Merged

Xuanwo merged 1 commit into
mainfrom
xuanwo/repdef-nested-validity

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Sep 16, 2026

Copy link
Copy Markdown
Member

Writing a nullable struct inside a list can lose the repetition/definition slots reserved for null and empty lists. Recording the struct validity resets current_len to the child array length, so recording its nullable child next violates the serializer length invariant.

Keep the special slots in current_len when recording validity. The regression round-trips a null list, a populated list with null struct and child values, and an empty list through both validity layers and the list offsets.

The required cargo clippy --all --tests --benches -- -D warnings is blocked by existing clippy::single_range_in_vec_init diagnostics in encodings/logical/primitive/blob.rs, array_encoding/physical/bitpack.rs, and encodings/logical/primitive/sparse.rs on Rust 1.97.0.

@github-actions github-actions Bot added A-encoding Encoding, IO, file reader/writer bug Something isn't working labels Sep 16, 2026
@Xuanwo
Xuanwo marked this pull request as ready for review September 16, 2026 06:16

@lance-gatekeeper lance-gatekeeper Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Gate recommendation: approve.

The structural-length correction keeps null and empty-list special slots aligned across nested validity layers. It uses the established rep/def representation, and the new round-trip test covers the affected null, populated, and empty-list cases.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 16, 2026
@Xuanwo
Xuanwo merged commit cc0845b into main Sep 16, 2026
39 checks passed
@Xuanwo
Xuanwo deleted the xuanwo/repdef-nested-validity branch September 16, 2026 07:08
Xuanwo added a commit to lancedb/lancedb that referenced this pull request Sep 16, 2026
Update the Rust workspace and Java Lance dependencies to
[v13.0.0-beta.3](https://github.com/lance-format/lance/releases/tag/v13.0.0-beta.3),
which includes the nullable-list encoding fix in
lance-format/lance#9268. Also resolve existing strict Clippy diagnostics
in crate-private OAuth modules and the Python token-cache conversion,
without changing effective visibility.

Validated the rebuilt Python SDK with nullable and nested lists:
Match/Phrase searches preserve document coordinates before and after
appending data and optimizing the table.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-encoding Encoding, IO, file reader/writer bug Something isn't working K-approved Latest Gatekeeper recommendation permits acceptance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants