Repository navigation
perf(btree): specialize bounded UInt64 lookup streams - #10420
Conversation
Keep overlay exclusions when deletion vectors are present and preserve signed reserved field IDs during column rewrites. Extracted from #10152 with matching regression coverage. BREAKING CHANGE: OldIndexDataFilter gains a RowAddresses variant; downstream exhaustive matches need another arm.
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
Bring the accepted UInt64 exact-lookup layer onto current main. Main already carries the final squashed #10418 segment-maintenance and #10419 prepared-key implementations plus the later ordered-search and cache-metrics work, so the historically stacked copies of those commits are dropped in favor of main's resolved code. Conflicts resolved as: - rust/lance-core/src/cache/{backend,mod,quick}.rs: take main. The branch-side copies were byte-identical to the pre-squash #10419 commits and this layer does not touch the cache crate. - rust/lance-index/src/scalar/btree.rs: keep both module declarations (`lookup` from this layer, `ordered` from main) and merge the test imports.
This layer moves `Matches::page_id` onto the `PageQuery` trait so cached and missing pages can share one evaluation stream. Ordered search, which landed on main independently, still called the inherent method and no longer resolved. Bring the trait into scope in both the module and its tests instead of restoring a duplicate inherent accessor.
Pick up the 15.0.0-beta.18 release version bump so validation and hosted CI run against the current main.
There was a problem hiding this comment.
No blocking issue found; the BTree patch is unchanged from the revision with 329 passing local BTree tests. The reported benchmark covers one unique-UInt64-address workload. Ordinary-search throughput and cache trade-offs at a fixed budget remain unverified; a base-versus-head comparison on representative workloads would quantify that risk.
Xuanwo
left a comment
There was a problem hiding this comment.
Approved for squash merge at 373656c. The accepted UInt64 BTree lookup specialization is unchanged across both ordinary main merges, and fmt, clippy plus the scalar, btree and overlay ci-profile suites are green on this SHA. The gatekeeper's fixed-budget ordinary-search performance uncertainty is accepted as non-blocking, and the benchmark claim stays limited to the single UInt64 workload.
UInt64 exact-match lookup can route keys directly to regular BTree pages and reuse a derived mapping within each cached page. This adds that path with ordered matching for irregular ranges and duplicate values. Repeated matches expand lazily into bounded batches, and cached pages are evaluated after one cache access; missing pages retain bounded, coalesced reads. The specialization is gated on
results_are_row_addresses && data_type == UInt64, every other type and the legacy row-id domain keep the generic path, null keys are dropped before matching, and repeated physical page ids fall back to whole-query matching so keys are never lost.The cached page directory precharges its lazy key slots (roughly
pages * size_of::<PageCacheKey>()) so cache admission cannot be outgrown during initialization; that charge is bounded and paid once per cached directory rather than per lookup.This layer changes BTree lookup and its tests only; persistent index files are unchanged. #10418 and #10419 have already landed, so this branch is kept current with ordinary merges of
main. #10421 is a later layer, not a dependency for this one.Validation at
373656ccd1208483f09396dbf0bfc3bddac452fc(cargo 1.98.1,ciprofile):cargo fmt --all -- --check— cleancargo test --profile ci -p lance-index --lib scalar— 2400 passed, 0 failed, 2 ignored (both pre-existing and unrelated)cargo test --profile ci -p lance --lib btree— 159 passed, 0 failedcargo test --profile ci -p lance --lib dataset_overlay_index_masking— 155 passed, 0 failed, 1 ignoredcargo clippy --profile ci --all --tests --benches -- -D warnings— cleanBenchmark evidence covers a single UInt64-address workload only (1M unique keys, 8192 random probes,
release-with-debug), so it is not a claim of a universal speedup; the checked-in performance evidence is the deterministic comparison-count and lazy-batch-size tests. "Cold" there meansLanceCache::no_cache(), not cold disk, and historical timings belong to41687579f/dbff5f8f6as supplementary data.Original implementation by @BubbleCal.