Skip to content

feat(rowids): add ordered deletion-aware address lookup - #10421

Open
BubbleCal wants to merge 6 commits into
mainfrom
yang/srid-stack-lookup
Open

BubbleCal wants to merge 6 commits into
mainfrom
yang/srid-stack-lookup

Conversation

@BubbleCal

@BubbleCal BubbleCal commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Add a Dataset lookup path that resolves unique keys to live physical addresses in input order. It preserves repeated requests and missing/null entries, rejects multiple live matches, filters deleted addresses, and scans uncovered fragments in bounded batches. Compact inline row-ID ranges use metadata arithmetic; prepared plans are scoped to the snapshot and object stores.

Read, take and merge-insert lookup callers use this path without constructing the full reverse map. Explicit takes that ignore deletions retain sequence-based resolution.

Layer 4 of the #10152 split, stacked on #10420 → #10419 → #10418. Persistent _rowid index creation, bindings and lifecycle coverage remain in #10152; bounded bulk capture is the final layer.

Integrated with main at 1fc6a853 (merge commit 1b05cae4). The three prerequisites are already on main, so those layers resolve to main's landed content, and the two merge-insert delete lookups were ported to merge_insert/job.rs. Verified at 00217f79: formatting, full workspace Clippy, cargo check --workspace --tests --benches, the row-ID, take, merge-insert and BTree test selectors, and the row_ids_to_row_addrs doctest.

Validation at author head e15f792ef (historical): 108 row-ID tests, 56 take tests, 11 ordering tests and 398 merge-insert tests passed. Full workspace Clippy, formatting and commit hooks passed. This head makes no universal speedup claim: it trades first-call and resident index construction for per-request scans of uncovered fragments.

Review and merge order: #10418 → #10419 → #10420 → #10421 → #10152 → #10422.

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.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

@github-actions github-actions Bot added the enhancement New feature or request label Oct 28, 2026

@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 with a non-blocking risk.

The solution follows the agreed ordered, deletion-aware take contract. For latency-sensitive adoption, keep the caller rollout aligned with the persistent _rowid index support retained in #10152 and coverage catch-up.

}
}
let mut scan = self.scan();
scan.with_fragments(plan.uncovered.clone())

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.

Repeated reads of non-range stable IDs scan every uncovered fragment again for each lookup request, including each batch resolved by TakeStream. Processing is incremental, but the prepared plan does not amortize that matching work across requests.

This matters for adopting this extracted layer: _rowid index creation remains in #10152, and the current CreateIndexBuilder rejects that column, so these tables cannot yet add lookup coverage through normal index creation. Pair deployment with that support and coverage catch-up for latency-sensitive workloads. The related measurements explain the trade-off, but are historical; latency at this extracted head remains unmeasured.

@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Oct 28, 2026
@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. and removed K-risk Latest Gatekeeper recommendation includes a non-blocking risk. K-approved Latest Gatekeeper recommendation permits acceptance. labels Oct 28, 2026
Base automatically changed from yang/srid-stack-btree to main November 11, 2026 21:29
Xuanwo added a commit that referenced this pull request Nov 11, 2026
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,
`ci` profile):

- `cargo fmt --all -- --check` — clean
- `cargo 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 failed
- `cargo test --profile ci -p lance --lib dataset_overlay_index_masking`
— 155 passed, 0 failed, 1 ignored
- `cargo clippy --profile ci --all --tests --benches -- -D warnings` —
clean

Benchmark 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
means `LanceCache::no_cache()`, not cold disk, and historical timings
belong to `41687579f`/`dbff5f8f6` as supplementary data.

Original implementation by @BubbleCal.

---------

Co-authored-by: Xuanwo <[email protected]>
@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. and removed K-risk Latest Gatekeeper recommendation includes a non-blocking risk. K-approved Latest Gatekeeper recommendation permits acceptance. labels Nov 11, 2026
Resolve the conflicts left by the moved merge-insert modules and by the
prerequisite layers that have since landed on main (#10418, #10419, #10420):
take main's landed content for those files and port the two delete-path row-id
lookups into merge_insert/job.rs.
@lance-gatekeeper lance-gatekeeper Bot removed K-risk Latest Gatekeeper recommendation includes a non-blocking risk. K-approved Latest Gatekeeper recommendation permits acceptance. labels Nov 16, 2026

@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 with a non-blocking risk.

The solution preserves the ordered, deletion-aware take contract. For latency-sensitive adoption, keep rollout aligned with the persistent _rowid index support in #10152 and coverage catch-up. Production latency at this head remains unmeasured.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Nov 16, 2026
@lance-gatekeeper lance-gatekeeper Bot added the K-risk Latest Gatekeeper recommendation includes a non-blocking risk. label Nov 16, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants