perf(encoding): auto-select sparse structural pages#7756
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Important This PR touches the Lance format specification. Substantive changes to the format specification — the If this is a meaningful format change:
|
Part of #7750
Summary
This is the policy/performance layer that turns the already-readable and explicitly-writable sparse format on automatically only for over-budget eligible pages.
Dependencies
Verification
cargo fmt --allcargo check --workspace --tests --benchescargo test -p lance-encoding encodings::logical::primitive::layout::tests(3 passed)cargo test -p lance-encoding encodings::logical::primitive::sparse::writer::tests(17 passed)cargo test -p lance-encoding --lib(464 passed, 5 ignored)cargo test -p lance-file(92 unit tests and doctests passed)cargo clippy --all --tests --benches -- -D warningsThe focused matrix covers within-budget lazy selection, split-required and single-row-over-budget auto selection, sparse eligibility, dictionary, variable packed-struct, wide fixed-size-binary, and wide fixed-size-list dense preservation, all explicit modes, Lance 2.2 compatibility, page counts, range/take reads, and round trips.
100M-row S3 benchmark
Environment:
r7i.8xlargeinus-east-2b, Lance V2.3, 100 files of 1,000,000 rows, 65,536-row write batches, and 1,024-row takes. The final committed harness is at66c936391aa46bfcd14f7ac1c820878da68fcc0bonxuanwo/sparse-stack-5-auto-sparse-bench-final, based on PR headed0ce68d7f4cceafe6a249c912f7f1da8c4fecd9.Cases:
hnsw:List<UInt32>; the first 1/7 of rows (14,285,714 of 100M) contain 32 consecutive values, followed by an empty tail.uniform:List<UInt32>; one singleton non-empty row every 10,000 rows.deep:Struct<events: List<Struct<id: Int32, tags: List<Int32>, pair: FixedSizeList<Int32; 2>>>>; non-empty every 4,096 rows with nullable top struct, event list, event struct, id, tags, pair, and pair items.Command:
coldis the first operation on a newly openedDataset;warmis the immediate repeat on the sameDataset. Times are milliseconds. Bytes are total dataset object bytes. Every dataset has 102 objects, including 100 Lance data files.deep/full-zipwrote all 100M rows and produced the reported size/page/object counts, then its first full scan panicked atprimitive.rs:2588by unwrapping a missing fixed full-zip decode task. Sparse and mini-block completed all reads. A separate 200K-row check at the exact PR4 base SHAda06b79a7f5eda4f33e2d80990c46766095ba383independently confirmed that this nested-nulldeep/full-zipread was already broken before this PR, returningStructural validity has 6 entries for an array with 7 values. The precise failure site varies with this decoder path, but explicit full-zip never enters PR5's automatic sparse candidate closure, so this is not an auto-sparse regression. The policy deliberately does not disguise that behavior as sparse support.Size-only comparisons
Parquet uses ZSTD level 3. Vortex uses 0.78.0 defaults.
Artifacts
s3://lance-bench-054483968661-us-east-2/xuanwo-sparse-pr5-20260713T133525Z/artifacts/lance-100m-20260713T144500Z.csvs3://lance-bench-054483968661-us-east-2/xuanwo-sparse-pr5-20260713T133525Z/artifacts/lance-100m-20260713T144500Z.errs3://lance-bench-054483968661-us-east-2/xuanwo-sparse-pr5-20260713T133525Z/artifacts/lance-100m-20260713T144500Z-failures.csvs3://lance-bench-054483968661-us-east-2/xuanwo-sparse-pr5-20260713T133525Z/artifacts/formats-100m-20260713T144500Z.csvs3://lance-bench-054483968661-us-east-2/xuanwo-sparse-pr5-20260713T133525Z/formats/100m-20260713T144500Z/s3://lance-bench-054483968661-us-east-2/xuanwo-sparse-pr5-20260713T133525Z/artifacts/pr4-baseline-deep-fullzip-200k.csvs3://lance-bench-054483968661-us-east-2/xuanwo-sparse-pr5-20260713T133525Z/artifacts/pr4-baseline-deep-fullzip-200k.err/home/ec2-user/sparse-pr5-results/20260713T144500Z/