Skip to content

Commit bc4cb04

Browse files
westonpaceclaude
andcommitted
refactor(index): introduce lance-index-core crate with abstract index trait layer
Extracts the abstract trait layer for scalar indices into a new `lance-index-core` crate (~17 deps vs 75+ in lance-index), enabling index plugin authors to implement ScalarIndex without depending on the full lance-index implementation crate. Moved to lance-index-core: Index, IndexType, IndexParams, MetricsCollector, ScalarIndex, AnyQuery, IndexStore/Reader/Writer, RowIdRemapper, SearchResult, CreatedIndex, UpdateCriteria, OldIndexDataFilter, ScalarIndexParams, BuiltinIndexType, TrainingCriteria/TrainingOrdering, IndexFile. lance-index and lance-table re-export all moved types for backward compatibility. FragReuseIndex/MemWalIndex trait impls move to lance-table where those types are defined. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> refactor(index): break lance-table → lance-index-core dependency Remove the unintended `lance-table → lance-index-core` dependency introduced in the previous commit. Key changes: - Restore `IndexFile` as a standalone struct in `lance-table` (duplicate of the one in `lance-index-core`), removing the re-export that forced the dep - Add `index_files_to_table()` / `table_files_to_index()` free functions in `lance-index` to convert between the two distinct `IndexFile` types - Introduce newtype wrappers `FragReuseIndexHandle` and `MemWalIndexHandle` in `lance-index` so that `Index` / `RowIdRemapper` (now in `lance-index-core`) can be implemented on the `lance-table` types without violating orphan rules - Remove the `lance-index-core` trait impls that were added directly on `FragReuseIndex` / `MemWalIndex` in `lance-table` - Update all call sites in `lance`, `lance-index`, and `lance-namespace-impls` to use the handle newtypes and conversion functions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent fff336c commit bc4cb04

40 files changed

Lines changed: 1364 additions & 1128 deletions

.bumpversion.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ filename = "Cargo.toml"
8080
search = 'lance-index = {{ version = "={current_version}"'
8181
replace = 'lance-index = {{ version = "={new_version}"'
8282

83+
[[tool.bumpversion.files]]
84+
filename = "Cargo.toml"
85+
search = 'lance-index-core = {{ version = "={current_version}"'
86+
replace = 'lance-index-core = {{ version = "={new_version}"'
87+
8388
[[tool.bumpversion.files]]
8489
filename = "Cargo.toml"
8590
search = 'lance-io = {{ version = "={current_version}"'

Cargo.lock

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ members = [
99
"rust/lance-file",
1010
"rust/lance-geo",
1111
"rust/lance-index",
12+
"rust/lance-index-core",
1213
"rust/lance-io",
1314
"rust/lance-linalg",
1415
"rust/lance-namespace",
@@ -67,6 +68,7 @@ lance-encoding = { version = "=9.0.0-beta.21", path = "./rust/lance-encoding" }
6768
lance-file = { version = "=9.0.0-beta.21", path = "./rust/lance-file" }
6869
lance-geo = { version = "=9.0.0-beta.21", path = "./rust/lance-geo" }
6970
lance-index = { version = "=9.0.0-beta.21", path = "./rust/lance-index" }
71+
lance-index-core = { version = "=9.0.0-beta.21", path = "./rust/lance-index-core" }
7072
lance-io = { version = "=9.0.0-beta.21", path = "./rust/lance-io", default-features = false }
7173
lance-linalg = { version = "=9.0.0-beta.21", path = "./rust/lance-linalg" }
7274
lance-namespace = { version = "=9.0.0-beta.21", path = "./rust/lance-namespace" }

java/lance-jni/Cargo.lock

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

python/Cargo.lock

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

python/src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ impl Hnsw {
255255
rt().block_on(Some(py), async {
256256
let batch = self.hnsw.to_batch()?;
257257
let metadata = batch.schema_ref().metadata().clone();
258-
writer.write_record_batch(batch).await?;
258+
writer.write(&[batch]).await?;
259259
writer.finish_with_metadata(&metadata).await?;
260260
Result::Ok(())
261261
})?

rust/lance-index-core/Cargo.toml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[package]
2+
name = "lance-index-core"
3+
version.workspace = true
4+
edition.workspace = true
5+
authors.workspace = true
6+
license.workspace = true
7+
repository.workspace = true
8+
readme = "README.md"
9+
description = "Core traits and types for Lance index plugins"
10+
keywords.workspace = true
11+
categories.workspace = true
12+
rust-version.workspace = true
13+
14+
[dependencies]
15+
async-trait.workspace = true
16+
arrow-array.workspace = true
17+
arrow-schema.workspace = true
18+
arrow-select.workspace = true
19+
bytes.workspace = true
20+
datafusion-common.workspace = true
21+
datafusion-expr.workspace = true
22+
datafusion.workspace = true
23+
futures.workspace = true
24+
lance-core.workspace = true
25+
lance-io.workspace = true
26+
lance-select.workspace = true
27+
prost-types.workspace = true
28+
roaring.workspace = true
29+
serde.workspace = true
30+
serde_json.workspace = true
31+
32+
[lints]
33+
workspace = true

0 commit comments

Comments
 (0)