Compare commits

...

3 Commits

Author SHA1 Message Date
Lance Release
dae8334d0b Bump version: 0.17.1 → 0.17.2-beta.0 2024-12-25 08:28:59 +00:00
BubbleCal
8c81968b59 feat: support IVF_FLAT on remote table in rust (#1979)
Signed-off-by: BubbleCal <bubble-cal@outlook.com>
2024-12-25 15:54:17 +08:00
BubbleCal
16cf2990f3 feat: create IVF_FLAT on remote table (#1978)
Signed-off-by: BubbleCal <bubble-cal@outlook.com>
2024-12-25 14:57:07 +08:00
4 changed files with 13 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
[tool.bumpversion] [tool.bumpversion]
current_version = "0.17.1" current_version = "0.17.2-beta.0"
parse = """(?x) parse = """(?x)
(?P<major>0|[1-9]\\d*)\\. (?P<major>0|[1-9]\\d*)\\.
(?P<minor>0|[1-9]\\d*)\\. (?P<minor>0|[1-9]\\d*)\\.

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "lancedb-python" name = "lancedb-python"
version = "0.17.1" version = "0.17.2-beta.0"
edition.workspace = true edition.workspace = true
description = "Python bindings for LanceDB" description = "Python bindings for LanceDB"
license.workspace = true license.workspace = true

View File

@@ -19,7 +19,7 @@ import warnings
from lancedb._lancedb import IndexConfig from lancedb._lancedb import IndexConfig
from lancedb.embeddings.base import EmbeddingFunctionConfig from lancedb.embeddings.base import EmbeddingFunctionConfig
from lancedb.index import FTS, BTree, Bitmap, HnswPq, HnswSq, IvfPq, LabelList from lancedb.index import FTS, BTree, Bitmap, HnswPq, HnswSq, IvfFlat, IvfPq, LabelList
from lancedb.remote.db import LOOP from lancedb.remote.db import LOOP
import pyarrow as pa import pyarrow as pa
@@ -235,10 +235,12 @@ class RemoteTable(Table):
config = HnswPq(distance_type=metric) config = HnswPq(distance_type=metric)
elif index_type == "IVF_HNSW_SQ": elif index_type == "IVF_HNSW_SQ":
config = HnswSq(distance_type=metric) config = HnswSq(distance_type=metric)
elif index_type == "IVF_FLAT":
config = IvfFlat(distance_type=metric)
else: else:
raise ValueError( raise ValueError(
f"Unknown vector index type: {index_type}. Valid options are" f"Unknown vector index type: {index_type}. Valid options are"
" 'IVF_PQ', 'IVF_HNSW_PQ', 'IVF_HNSW_SQ'" " 'IVF_FLAT', 'IVF_PQ', 'IVF_HNSW_PQ', 'IVF_HNSW_SQ'"
) )
LOOP.run(self._table.create_index(vector_column_name, config=config)) LOOP.run(self._table.create_index(vector_column_name, config=config))

View File

@@ -563,6 +563,7 @@ impl<S: HttpSend> TableInternal for RemoteTable<S> {
let (index_type, distance_type) = match index.index { let (index_type, distance_type) = match index.index {
// TODO: Should we pass the actual index parameters? SaaS does not // TODO: Should we pass the actual index parameters? SaaS does not
// yet support them. // yet support them.
Index::IvfFlat(index) => ("IVF_FLAT", Some(index.distance_type)),
Index::IvfPq(index) => ("IVF_PQ", Some(index.distance_type)), Index::IvfPq(index) => ("IVF_PQ", Some(index.distance_type)),
Index::IvfHnswSq(index) => ("IVF_HNSW_SQ", Some(index.distance_type)), Index::IvfHnswSq(index) => ("IVF_HNSW_SQ", Some(index.distance_type)),
Index::BTree(_) => ("BTREE", None), Index::BTree(_) => ("BTREE", None),
@@ -873,6 +874,7 @@ mod tests {
use lance_index::scalar::FullTextSearchQuery; use lance_index::scalar::FullTextSearchQuery;
use reqwest::Body; use reqwest::Body;
use crate::index::vector::IvfFlatIndexBuilder;
use crate::{ use crate::{
index::{vector::IvfPqIndexBuilder, Index, IndexStatistics, IndexType}, index::{vector::IvfPqIndexBuilder, Index, IndexStatistics, IndexType},
query::{ExecutableQuery, QueryBase}, query::{ExecutableQuery, QueryBase},
@@ -1489,6 +1491,11 @@ mod tests {
#[tokio::test] #[tokio::test]
async fn test_create_index() { async fn test_create_index() {
let cases = [ let cases = [
(
"IVF_FLAT",
Some("hamming"),
Index::IvfFlat(IvfFlatIndexBuilder::default().distance_type(DistanceType::Hamming)),
),
("IVF_PQ", Some("l2"), Index::IvfPq(Default::default())), ("IVF_PQ", Some("l2"), Index::IvfPq(Default::default())),
( (
"IVF_PQ", "IVF_PQ",