Skip to content

fix(encoding): decode empty inline-bitpacked blocks#7752

Merged
Xuanwo merged 1 commit into
mainfrom
xuanwo/sparse-stack-2-empty-inline-bitpacked
Jul 13, 2026
Merged

fix(encoding): decode empty inline-bitpacked blocks#7752
Xuanwo merged 1 commit into
mainfrom
xuanwo/sparse-stack-2-empty-inline-bitpacked

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Part of #7750

Inline bitpacking mini-block decompression currently enters the non-empty unchunk path for zero values, which expects an inline bit-width header and panics on an empty payload. Return an empty FixedWidthDataBlock with the configured bit width instead.

This is the generic zero-value codec prerequisite used when sparse pages project to no leaf values. It contains no sparse format or layout behavior.

Validation:

  • cargo fmt --all -- --check
  • cargo test -p lance-encoding encodings::physical::bitpacking::test
  • cargo test -p lance-encoding
  • cargo clippy -p lance-encoding --tests --benches -- -D warnings
  • cargo clippy --all --tests --benches -- -D warnings

Summary by CodeRabbit

  • Bug Fixes

    • Fixed decompression for empty bitpacked data blocks.
    • Empty miniblocks now return correctly formatted empty results without attempting to read missing metadata.
  • Tests

    • Added coverage to verify empty miniblock handling.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 0bf9c948-cf87-4356-b2af-ee48d5e70e19

📥 Commits

Reviewing files that changed from the base of the PR and between e7bce1e and 18cb458.

📒 Files selected for processing (1)
  • rust/lance-encoding/src/encodings/physical/bitpacking.rs

📝 Walkthrough

Walkthrough

InlineBitpacking decompression now handles zero-value miniblocks without reading a missing inline header. A parameterized unit test verifies the resulting empty fixed-width block across supported bit widths.

Changes

Empty inline bitpacking handling

Layer / File(s) Summary
Empty miniblock decompression and validation
rust/lance-encoding/src/encodings/physical/bitpacking.rs
Zero-value miniblocks return an empty fixed-width block using the encoder’s uncompressed bit width, with tests covering bit widths, value count, and data length.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: handling empty inline bitpacked blocks during decoding.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch xuanwo/sparse-stack-2-empty-inline-bitpacked

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added A-encoding Encoding, IO, file reader/writer bug Something isn't working labels Jul 13, 2026
@Xuanwo
Xuanwo marked this pull request as ready for review July 13, 2026 10:39
@Xuanwo
Xuanwo merged commit 4f7224b into main Jul 13, 2026
34 checks passed
@Xuanwo
Xuanwo deleted the xuanwo/sparse-stack-2-empty-inline-bitpacked branch July 13, 2026 11:16
@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Xuanwo
Xuanwo restored the xuanwo/sparse-stack-2-empty-inline-bitpacked branch July 13, 2026 12:08
Xuanwo added a commit that referenced this pull request Jul 21, 2026
Part of #7750

Depends on #7752.
Wire contract discussion:
#7631. The
validity-polarity text and vote remain a merge gate.

This PR freezes the Lance 2.3 SparseLayout wire contract and lands its
safe, selective reader together with an explicit writer so the contract
is exercised end to end. The reader rejects SparseLayout in pre-2.3
files, validates metadata, domains, semantic sets, descriptors, buffer
ranges, compression headers, chunk sums, and complete chunk consumption,
caches normalized plans, projects range/take selections through nested
layers, reads only intersecting value chunks, and rebuilds no-value
selections without value I/O. SparseLayout adds no format-specific size
or descriptor-complexity quotas for otherwise representable buffers;
callers retain responsibility for resource policy.

The writer can emit sparse pages only when field metadata explicitly
sets `lance-encoding:structural-encoding=sparse` for a Lance 2.3 file.
It does not add automatic selection or change the default encoding
policy. Lance 2.3 is unstable, so tests generate pages at runtime and
round-trip them; this PR contains no checked-in compatibility fixture or
generated test artifact.

Coverage includes nullable primitive and struct,
list/large-list/map/fixed-size-list, null versus empty lists, both
validity polarities, all semantic position/count representations, scan,
range, take, deeply nested structures, no-value selections, selective
value I/O, malformed pages, large representable buffers/descriptors, and
pre-2.3 rejection.

Validation:

- `cargo fmt --all -- --check`
- `cargo check -p lance-encoding -p lance-file --features protoc`
- `protoc --descriptor_set_out=/dev/null --proto_path=protos
protos/encodings_v2_1.proto protos/file2.proto`
- `cargo test -p lance-encoding -p lance-file` (470 + 93 passed; 0
failed)
- focused sparse reader/writer and malformed-page tests
- `uv run mkdocs build`
- `cargo clippy --all --tests --benches -- -D warnings`

---------

Co-authored-by: Weston Pace <[email protected]>
Xuanwo added a commit that referenced this pull request Jul 21, 2026
Part of #7750

Depends on #7752.
Wire contract discussion:
#7631. The
validity-polarity text and vote remain a merge gate.

This PR freezes the Lance 2.3 SparseLayout wire contract and lands its
safe, selective reader together with an explicit writer so the contract
is exercised end to end. The reader rejects SparseLayout in pre-2.3
files, validates metadata, domains, semantic sets, descriptors, buffer
ranges, compression headers, chunk sums, and complete chunk consumption,
caches normalized plans, projects range/take selections through nested
layers, reads only intersecting value chunks, and rebuilds no-value
selections without value I/O. SparseLayout adds no format-specific size
or descriptor-complexity quotas for otherwise representable buffers;
callers retain responsibility for resource policy.

The writer can emit sparse pages only when field metadata explicitly
sets `lance-encoding:structural-encoding=sparse` for a Lance 2.3 file.
It does not add automatic selection or change the default encoding
policy. Lance 2.3 is unstable, so tests generate pages at runtime and
round-trip them; this PR contains no checked-in compatibility fixture or
generated test artifact.

Coverage includes nullable primitive and struct,
list/large-list/map/fixed-size-list, null versus empty lists, both
validity polarities, all semantic position/count representations, scan,
range, take, deeply nested structures, no-value selections, selective
value I/O, malformed pages, large representable buffers/descriptors, and
pre-2.3 rejection.

Validation:

- `cargo fmt --all -- --check`
- `cargo check -p lance-encoding -p lance-file --features protoc`
- `protoc --descriptor_set_out=/dev/null --proto_path=protos
protos/encodings_v2_1.proto protos/file2.proto`
- `cargo test -p lance-encoding -p lance-file` (470 + 93 passed; 0
failed)
- focused sparse reader/writer and malformed-page tests
- `uv run mkdocs build`
- `cargo clippy --all --tests --benches -- -D warnings`

---------

Co-authored-by: Weston Pace <[email protected]>
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants