List and VarBin constructors decode compressed offsets twice

Open
#11,796 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
performance

Research direction

Start with ListData::validate and VarBinData::validate_utf8, where the offsets are decoded during construction and the decoded copy is dropped. Then read list_view_from_list in listview/conversion.rs and the canonical path in varbin/vtable/canonical.rs, which decode the offsets again. Done when a compressed-offset List or VarBin array decodes its offsets at most once between construction and canonicalization, and the existing tests still pass.

Written by the indexing model from the issue text.

Description

Follow-up to #11222.

ListArray and VarBinArray, both Utf8 and Binary, decode their offsets to a PrimitiveArray when they are built, to check that the offsets are valid. They keep the original offsets and drop the decoded copy. When the array is canonicalized later, the offsets are decoded again: by list_view_from_list in listview/conversion.rs for List, and in varbin/vtable/canonical.rs for VarBin. So a List or VarBin array whose offsets are compressed, for example one read from a file, decodes its offsets twice.

Utf8 VarBin already did this before #11222: VarBinData::validate_utf8 decodes the offsets to check UTF-8 boundaries (see its TODO(joe)). #11222 adds the same pattern for List and Binary VarBin, with its own TODO in ListData::validate.

I have not measured the cost. It is one extra decode of len + 1 integers per array.

Expected: for List, Utf8 VarBin and Binary VarBin, the offsets are decoded at most once between construction and canonicalization.

🤖 Generated with Claude Code

Dominant language
Rust
Stars
3.2k
Forks
239
Avg merge
1d 4h
Merged PRs (30d)
684

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from vortex-data/vortex

All issues in vortex-data/vortex

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.