Compare commits

..

2 Commits

Author SHA1 Message Date
BubbleCal
929c683a6e Handle version number refs 2025-12-22 16:53:16 +08:00
lancedb automation
e2794d1a29 chore: update lance dependency to v2.0.0-beta.3 2025-12-19 22:04:10 +00:00
4 changed files with 105 additions and 88 deletions

69
Cargo.lock generated
View File

@@ -3141,8 +3141,8 @@ checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c"
[[package]]
name = "fsst"
version = "2.0.0-beta.5"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.5#26ad809c3fa0f1785f40bba27e0cca40431bf85b"
version = "2.0.0-beta.3"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.3#e6233665e377926ed2a8ceca667bc7a2f23341ae"
dependencies = [
"arrow-array",
"rand 0.9.2",
@@ -4478,8 +4478,8 @@ dependencies = [
[[package]]
name = "lance"
version = "2.0.0-beta.5"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.5#26ad809c3fa0f1785f40bba27e0cca40431bf85b"
version = "2.0.0-beta.3"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.3#e6233665e377926ed2a8ceca667bc7a2f23341ae"
dependencies = [
"arrow",
"arrow-arith",
@@ -4544,8 +4544,8 @@ dependencies = [
[[package]]
name = "lance-arrow"
version = "2.0.0-beta.5"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.5#26ad809c3fa0f1785f40bba27e0cca40431bf85b"
version = "2.0.0-beta.3"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.3#e6233665e377926ed2a8ceca667bc7a2f23341ae"
dependencies = [
"arrow-array",
"arrow-buffer",
@@ -4564,8 +4564,8 @@ dependencies = [
[[package]]
name = "lance-bitpacking"
version = "2.0.0-beta.5"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.5#26ad809c3fa0f1785f40bba27e0cca40431bf85b"
version = "2.0.0-beta.3"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.3#e6233665e377926ed2a8ceca667bc7a2f23341ae"
dependencies = [
"arrayref",
"paste",
@@ -4574,8 +4574,8 @@ dependencies = [
[[package]]
name = "lance-core"
version = "2.0.0-beta.5"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.5#26ad809c3fa0f1785f40bba27e0cca40431bf85b"
version = "2.0.0-beta.3"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.3#e6233665e377926ed2a8ceca667bc7a2f23341ae"
dependencies = [
"arrow-array",
"arrow-buffer",
@@ -4612,8 +4612,8 @@ dependencies = [
[[package]]
name = "lance-datafusion"
version = "2.0.0-beta.5"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.5#26ad809c3fa0f1785f40bba27e0cca40431bf85b"
version = "2.0.0-beta.3"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.3#e6233665e377926ed2a8ceca667bc7a2f23341ae"
dependencies = [
"arrow",
"arrow-array",
@@ -4643,8 +4643,8 @@ dependencies = [
[[package]]
name = "lance-datagen"
version = "2.0.0-beta.5"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.5#26ad809c3fa0f1785f40bba27e0cca40431bf85b"
version = "2.0.0-beta.3"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.3#e6233665e377926ed2a8ceca667bc7a2f23341ae"
dependencies = [
"arrow",
"arrow-array",
@@ -4655,15 +4655,14 @@ dependencies = [
"half",
"hex",
"rand 0.9.2",
"rand_distr 0.5.1",
"rand_xoshiro",
"random_word 0.5.2",
]
[[package]]
name = "lance-encoding"
version = "2.0.0-beta.5"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.5#26ad809c3fa0f1785f40bba27e0cca40431bf85b"
version = "2.0.0-beta.3"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.3#e6233665e377926ed2a8ceca667bc7a2f23341ae"
dependencies = [
"arrow-arith",
"arrow-array",
@@ -4700,8 +4699,8 @@ dependencies = [
[[package]]
name = "lance-file"
version = "2.0.0-beta.5"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.5#26ad809c3fa0f1785f40bba27e0cca40431bf85b"
version = "2.0.0-beta.3"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.3#e6233665e377926ed2a8ceca667bc7a2f23341ae"
dependencies = [
"arrow-arith",
"arrow-array",
@@ -4733,8 +4732,8 @@ dependencies = [
[[package]]
name = "lance-geo"
version = "2.0.0-beta.5"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.5#26ad809c3fa0f1785f40bba27e0cca40431bf85b"
version = "2.0.0-beta.3"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.3#e6233665e377926ed2a8ceca667bc7a2f23341ae"
dependencies = [
"datafusion",
"geo-types",
@@ -4745,8 +4744,8 @@ dependencies = [
[[package]]
name = "lance-index"
version = "2.0.0-beta.5"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.5#26ad809c3fa0f1785f40bba27e0cca40431bf85b"
version = "2.0.0-beta.3"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.3#e6233665e377926ed2a8ceca667bc7a2f23341ae"
dependencies = [
"arrow",
"arrow-arith",
@@ -4808,8 +4807,8 @@ dependencies = [
[[package]]
name = "lance-io"
version = "2.0.0-beta.5"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.5#26ad809c3fa0f1785f40bba27e0cca40431bf85b"
version = "2.0.0-beta.3"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.3#e6233665e377926ed2a8ceca667bc7a2f23341ae"
dependencies = [
"arrow",
"arrow-arith",
@@ -4849,8 +4848,8 @@ dependencies = [
[[package]]
name = "lance-linalg"
version = "2.0.0-beta.5"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.5#26ad809c3fa0f1785f40bba27e0cca40431bf85b"
version = "2.0.0-beta.3"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.3#e6233665e377926ed2a8ceca667bc7a2f23341ae"
dependencies = [
"arrow-array",
"arrow-buffer",
@@ -4866,8 +4865,8 @@ dependencies = [
[[package]]
name = "lance-namespace"
version = "2.0.0-beta.5"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.5#26ad809c3fa0f1785f40bba27e0cca40431bf85b"
version = "2.0.0-beta.3"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.3#e6233665e377926ed2a8ceca667bc7a2f23341ae"
dependencies = [
"arrow",
"async-trait",
@@ -4879,8 +4878,8 @@ dependencies = [
[[package]]
name = "lance-namespace-impls"
version = "2.0.0-beta.5"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.5#26ad809c3fa0f1785f40bba27e0cca40431bf85b"
version = "2.0.0-beta.3"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.3#e6233665e377926ed2a8ceca667bc7a2f23341ae"
dependencies = [
"arrow",
"arrow-ipc",
@@ -4922,8 +4921,8 @@ dependencies = [
[[package]]
name = "lance-table"
version = "2.0.0-beta.5"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.5#26ad809c3fa0f1785f40bba27e0cca40431bf85b"
version = "2.0.0-beta.3"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.3#e6233665e377926ed2a8ceca667bc7a2f23341ae"
dependencies = [
"arrow",
"arrow-array",
@@ -4962,8 +4961,8 @@ dependencies = [
[[package]]
name = "lance-testing"
version = "2.0.0-beta.5"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.5#26ad809c3fa0f1785f40bba27e0cca40431bf85b"
version = "2.0.0-beta.3"
source = "git+https://github.com/lance-format/lance.git?tag=v2.0.0-beta.3#e6233665e377926ed2a8ceca667bc7a2f23341ae"
dependencies = [
"arrow-array",
"arrow-schema",

View File

@@ -15,20 +15,20 @@ categories = ["database-implementations"]
rust-version = "1.78.0"
[workspace.dependencies]
lance = { "version" = "=2.0.0-beta.5", default-features = false, "tag" = "v2.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
lance-core = { "version" = "=2.0.0-beta.5", "tag" = "v2.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
lance-datagen = { "version" = "=2.0.0-beta.5", "tag" = "v2.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
lance-file = { "version" = "=2.0.0-beta.5", "tag" = "v2.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
lance-io = { "version" = "=2.0.0-beta.5", default-features = false, "tag" = "v2.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
lance-index = { "version" = "=2.0.0-beta.5", "tag" = "v2.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
lance-linalg = { "version" = "=2.0.0-beta.5", "tag" = "v2.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
lance-namespace = { "version" = "=2.0.0-beta.5", "tag" = "v2.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
lance-namespace-impls = { "version" = "=2.0.0-beta.5", default-features = false, "tag" = "v2.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
lance-table = { "version" = "=2.0.0-beta.5", "tag" = "v2.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
lance-testing = { "version" = "=2.0.0-beta.5", "tag" = "v2.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
lance-datafusion = { "version" = "=2.0.0-beta.5", "tag" = "v2.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
lance-encoding = { "version" = "=2.0.0-beta.5", "tag" = "v2.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
lance-arrow = { "version" = "=2.0.0-beta.5", "tag" = "v2.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
lance = { "version" = "=2.0.0-beta.3", default-features = false, "tag" = "v2.0.0-beta.3", "git" = "https://github.com/lance-format/lance.git" }
lance-core = { "version" = "=2.0.0-beta.3", "tag" = "v2.0.0-beta.3", "git" = "https://github.com/lance-format/lance.git" }
lance-datagen = { "version" = "=2.0.0-beta.3", "tag" = "v2.0.0-beta.3", "git" = "https://github.com/lance-format/lance.git" }
lance-file = { "version" = "=2.0.0-beta.3", "tag" = "v2.0.0-beta.3", "git" = "https://github.com/lance-format/lance.git" }
lance-io = { "version" = "=2.0.0-beta.3", default-features = false, "tag" = "v2.0.0-beta.3", "git" = "https://github.com/lance-format/lance.git" }
lance-index = { "version" = "=2.0.0-beta.3", "tag" = "v2.0.0-beta.3", "git" = "https://github.com/lance-format/lance.git" }
lance-linalg = { "version" = "=2.0.0-beta.3", "tag" = "v2.0.0-beta.3", "git" = "https://github.com/lance-format/lance.git" }
lance-namespace = { "version" = "=2.0.0-beta.3", "tag" = "v2.0.0-beta.3", "git" = "https://github.com/lance-format/lance.git" }
lance-namespace-impls = { "version" = "=2.0.0-beta.3", default-features = false, "tag" = "v2.0.0-beta.3", "git" = "https://github.com/lance-format/lance.git" }
lance-table = { "version" = "=2.0.0-beta.3", "tag" = "v2.0.0-beta.3", "git" = "https://github.com/lance-format/lance.git" }
lance-testing = { "version" = "=2.0.0-beta.3", "tag" = "v2.0.0-beta.3", "git" = "https://github.com/lance-format/lance.git" }
lance-datafusion = { "version" = "=2.0.0-beta.3", "tag" = "v2.0.0-beta.3", "git" = "https://github.com/lance-format/lance.git" }
lance-encoding = { "version" = "=2.0.0-beta.3", "tag" = "v2.0.0-beta.3", "git" = "https://github.com/lance-format/lance.git" }
lance-arrow = { "version" = "=2.0.0-beta.3", "tag" = "v2.0.0-beta.3", "git" = "https://github.com/lance-format/lance.git" }
ahash = "0.8"
# Note that this one does not include pyarrow
arrow = { version = "56.2", optional = false }

View File

@@ -326,11 +326,11 @@ impl Connection {
let py = self_.py();
future_into_py(py, async move {
use lance_namespace::models::CreateNamespaceRequest;
let mode_enum = mode.and_then(|m| match m.to_lowercase().as_str() {
"create" => Some("Create".to_string()),
"exist_ok" => Some("ExistOk".to_string()),
"overwrite" => Some("Overwrite".to_string()),
_ => None,
let mode_value = mode.map(|m| match m.to_lowercase().as_str() {
"create" => "Create".to_string(),
"exist_ok" => "ExistOk".to_string(),
"overwrite" => "Overwrite".to_string(),
_ => m,
});
let request = CreateNamespaceRequest {
id: if namespace.is_empty() {
@@ -338,7 +338,7 @@ impl Connection {
} else {
Some(namespace)
},
mode: mode_enum,
mode: mode_value,
properties,
};
let response = inner.create_namespace(request).await.infer_error()?;
@@ -361,15 +361,15 @@ impl Connection {
let py = self_.py();
future_into_py(py, async move {
use lance_namespace::models::DropNamespaceRequest;
let mode_enum = mode.and_then(|m| match m.to_uppercase().as_str() {
"SKIP" => Some("Skip".to_string()),
"FAIL" => Some("Fail".to_string()),
_ => None,
let mode_value = mode.map(|m| match m.to_uppercase().as_str() {
"SKIP" => "Skip".to_string(),
"FAIL" => "Fail".to_string(),
_ => m,
});
let behavior_enum = behavior.and_then(|b| match b.to_uppercase().as_str() {
"RESTRICT" => Some("Restrict".to_string()),
"CASCADE" => Some("Cascade".to_string()),
_ => None,
let behavior_value = behavior.map(|b| match b.to_uppercase().as_str() {
"RESTRICT" => "Restrict".to_string(),
"CASCADE" => "Cascade".to_string(),
_ => b,
});
let request = DropNamespaceRequest {
id: if namespace.is_empty() {
@@ -377,8 +377,8 @@ impl Connection {
} else {
Some(namespace)
},
mode: mode_enum,
behavior: behavior_enum,
mode: mode_value,
behavior: behavior_value,
};
let response = inner.drop_namespace(request).await.infer_error()?;
Python::with_gil(|py| -> PyResult<Py<PyDict>> {

View File

@@ -2334,21 +2334,6 @@ impl NativeTable {
/// Convert an AnyQuery to the namespace QueryTableRequest format.
fn convert_to_namespace_query(&self, query: &AnyQuery) -> Result<NsQueryTableRequest> {
fn convert_select_to_columns(
select: &Select,
) -> Result<Option<Box<QueryTableRequestColumns>>> {
match select {
Select::All => Ok(None),
Select::Columns(cols) => Ok(Some(Box::new(QueryTableRequestColumns {
column_names: Some(cols.clone()),
column_aliases: None,
}))),
Select::Dynamic(_) => Err(Error::NotSupported {
message: "Dynamic columns are not supported for server-side query".to_string(),
}),
}
}
match query {
AnyQuery::VectorQuery(vq) => {
// Extract the query vector(s)
@@ -2361,7 +2346,20 @@ impl NativeTable {
};
// Convert select to columns list
let columns = convert_select_to_columns(&vq.base.select)?;
let columns = match &vq.base.select {
Select::All => None,
Select::Columns(cols) => Some(Box::new(QueryTableRequestColumns {
column_names: Some(cols.clone()),
column_aliases: None,
})),
Select::Dynamic(_) => {
return Err(Error::NotSupported {
message:
"Dynamic column selection is not supported for server-side queries"
.to_string(),
});
}
};
// Check for unsupported features
if vq.base.reranker.is_some() {
@@ -2424,7 +2422,19 @@ impl NativeTable {
.map(|f| self.filter_to_sql(f))
.transpose()?;
let columns = convert_select_to_columns(&q.select)?;
let columns = match &q.select {
Select::All => None,
Select::Columns(cols) => Some(Box::new(QueryTableRequestColumns {
column_names: Some(cols.clone()),
column_aliases: None,
})),
Select::Dynamic(_) => {
return Err(Error::NotSupported {
message: "Dynamic columns are not supported for server-side query"
.to_string(),
});
}
};
// Handle full text search if present
let full_text_query = q.full_text_search.as_ref().map(|fts| {
@@ -5142,9 +5152,13 @@ mod tests {
assert_eq!(ns_request.k, 10);
assert_eq!(ns_request.offset, Some(5));
assert_eq!(ns_request.filter, Some("id > 0".to_string()));
let columns = ns_request.columns.as_ref().unwrap();
assert_eq!(columns.column_names, Some(vec!["id".to_string()]));
assert!(columns.column_aliases.is_none());
assert_eq!(
ns_request
.columns
.as_ref()
.and_then(|c| c.column_names.clone()),
Some(vec!["id".to_string()])
);
assert_eq!(ns_request.vector_column, Some("vector".to_string()));
assert_eq!(ns_request.distance_type, Some("l2".to_string()));
assert!(ns_request.vector.single_vector.is_some());
@@ -5185,9 +5199,13 @@ mod tests {
assert_eq!(ns_request.k, 20);
assert_eq!(ns_request.offset, Some(5));
assert_eq!(ns_request.filter, Some("id > 5".to_string()));
let columns = ns_request.columns.as_ref().unwrap();
assert_eq!(columns.column_names, Some(vec!["id".to_string()]));
assert!(columns.column_aliases.is_none());
assert_eq!(
ns_request
.columns
.as_ref()
.and_then(|c| c.column_names.clone()),
Some(vec!["id".to_string()])
);
assert_eq!(ns_request.with_row_id, Some(true));
assert_eq!(ns_request.bypass_vector_index, Some(true));
assert!(ns_request.vector_column.is_none()); // No vector column for plain queries