mirror of
https://github.com/lancedb/lancedb.git
synced 2026-09-11 07:42:26 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f94349ef59 |
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
[tool.bumpversion]
|
[tool.bumpversion]
|
||||||
current_version = "0.27.0-beta.3"
|
current_version = "0.27.0-beta.2"
|
||||||
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*)\\.
|
||||||
|
|||||||
@@ -100,9 +100,7 @@ jobs:
|
|||||||
lfs: true
|
lfs: true
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: sudo apt install -y protobuf-compiler libssl-dev
|
||||||
sudo apt update
|
|
||||||
sudo apt install -y protobuf-compiler libssl-dev
|
|
||||||
- uses: rui314/setup-mold@v1
|
- uses: rui314/setup-mold@v1
|
||||||
- name: Make Swap
|
- name: Make Swap
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Generated
+162
-311
File diff suppressed because it is too large
Load Diff
+21
-23
@@ -15,20 +15,20 @@ categories = ["database-implementations"]
|
|||||||
rust-version = "1.91.0"
|
rust-version = "1.91.0"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
lance = { "version" = "=3.0.0-rc.2", default-features = false, "tag" = "v3.0.0-rc.2", "git" = "https://github.com/lance-format/lance.git" }
|
lance = { "version" = "=3.1.0-beta.2", default-features = false, "tag" = "v3.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" }
|
||||||
lance-core = { "version" = "=3.0.0-rc.2", "tag" = "v3.0.0-rc.2", "git" = "https://github.com/lance-format/lance.git" }
|
lance-core = { "version" = "=3.1.0-beta.2", "tag" = "v3.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" }
|
||||||
lance-datagen = { "version" = "=3.0.0-rc.2", "tag" = "v3.0.0-rc.2", "git" = "https://github.com/lance-format/lance.git" }
|
lance-datagen = { "version" = "=3.1.0-beta.2", "tag" = "v3.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" }
|
||||||
lance-file = { "version" = "=3.0.0-rc.2", "tag" = "v3.0.0-rc.2", "git" = "https://github.com/lance-format/lance.git" }
|
lance-file = { "version" = "=3.1.0-beta.2", "tag" = "v3.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" }
|
||||||
lance-io = { "version" = "=3.0.0-rc.2", default-features = false, "tag" = "v3.0.0-rc.2", "git" = "https://github.com/lance-format/lance.git" }
|
lance-io = { "version" = "=3.1.0-beta.2", default-features = false, "tag" = "v3.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" }
|
||||||
lance-index = { "version" = "=3.0.0-rc.2", "tag" = "v3.0.0-rc.2", "git" = "https://github.com/lance-format/lance.git" }
|
lance-index = { "version" = "=3.1.0-beta.2", "tag" = "v3.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" }
|
||||||
lance-linalg = { "version" = "=3.0.0-rc.2", "tag" = "v3.0.0-rc.2", "git" = "https://github.com/lance-format/lance.git" }
|
lance-linalg = { "version" = "=3.1.0-beta.2", "tag" = "v3.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" }
|
||||||
lance-namespace = { "version" = "=3.0.0-rc.2", "tag" = "v3.0.0-rc.2", "git" = "https://github.com/lance-format/lance.git" }
|
lance-namespace = { "version" = "=3.1.0-beta.2", "tag" = "v3.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" }
|
||||||
lance-namespace-impls = { "version" = "=3.0.0-rc.2", default-features = false, "tag" = "v3.0.0-rc.2", "git" = "https://github.com/lance-format/lance.git" }
|
lance-namespace-impls = { "version" = "=3.1.0-beta.2", default-features = false, "tag" = "v3.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" }
|
||||||
lance-table = { "version" = "=3.0.0-rc.2", "tag" = "v3.0.0-rc.2", "git" = "https://github.com/lance-format/lance.git" }
|
lance-table = { "version" = "=3.1.0-beta.2", "tag" = "v3.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" }
|
||||||
lance-testing = { "version" = "=3.0.0-rc.2", "tag" = "v3.0.0-rc.2", "git" = "https://github.com/lance-format/lance.git" }
|
lance-testing = { "version" = "=3.1.0-beta.2", "tag" = "v3.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" }
|
||||||
lance-datafusion = { "version" = "=3.0.0-rc.2", "tag" = "v3.0.0-rc.2", "git" = "https://github.com/lance-format/lance.git" }
|
lance-datafusion = { "version" = "=3.1.0-beta.2", "tag" = "v3.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" }
|
||||||
lance-encoding = { "version" = "=3.0.0-rc.2", "tag" = "v3.0.0-rc.2", "git" = "https://github.com/lance-format/lance.git" }
|
lance-encoding = { "version" = "=3.1.0-beta.2", "tag" = "v3.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" }
|
||||||
lance-arrow = { "version" = "=3.0.0-rc.2", "tag" = "v3.0.0-rc.2", "git" = "https://github.com/lance-format/lance.git" }
|
lance-arrow = { "version" = "=3.1.0-beta.2", "tag" = "v3.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" }
|
||||||
ahash = "0.8"
|
ahash = "0.8"
|
||||||
# Note that this one does not include pyarrow
|
# Note that this one does not include pyarrow
|
||||||
arrow = { version = "57.2", optional = false }
|
arrow = { version = "57.2", optional = false }
|
||||||
@@ -40,15 +40,13 @@ arrow-schema = "57.2"
|
|||||||
arrow-select = "57.2"
|
arrow-select = "57.2"
|
||||||
arrow-cast = "57.2"
|
arrow-cast = "57.2"
|
||||||
async-trait = "0"
|
async-trait = "0"
|
||||||
datafusion = { version = "52.1", default-features = false }
|
datafusion = { version = "51.0", default-features = false }
|
||||||
datafusion-catalog = "52.1"
|
datafusion-catalog = "51.0"
|
||||||
datafusion-common = { version = "52.1", default-features = false }
|
datafusion-common = { version = "51.0", default-features = false }
|
||||||
datafusion-execution = "52.1"
|
datafusion-execution = "51.0"
|
||||||
datafusion-expr = "52.1"
|
datafusion-expr = "51.0"
|
||||||
datafusion-functions = "52.1"
|
datafusion-physical-plan = "51.0"
|
||||||
datafusion-physical-plan = "52.1"
|
datafusion-physical-expr = "51.0"
|
||||||
datafusion-physical-expr = "52.1"
|
|
||||||
datafusion-sql = "52.1"
|
|
||||||
env_logger = "0.11"
|
env_logger = "0.11"
|
||||||
half = { "version" = "2.7.1", default-features = false, features = [
|
half = { "version" = "2.7.1", default-features = false, features = [
|
||||||
"num-traits",
|
"num-traits",
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ Add the following dependency to your `pom.xml`:
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lancedb</groupId>
|
<groupId>com.lancedb</groupId>
|
||||||
<artifactId>lancedb-core</artifactId>
|
<artifactId>lancedb-core</artifactId>
|
||||||
<version>0.27.0-beta.3</version>
|
<version>0.27.0-beta.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -8,14 +8,6 @@
|
|||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
### numDeletedRows
|
|
||||||
|
|
||||||
```ts
|
|
||||||
numDeletedRows: number;
|
|
||||||
```
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### version
|
### version
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lancedb</groupId>
|
<groupId>com.lancedb</groupId>
|
||||||
<artifactId>lancedb-parent</artifactId>
|
<artifactId>lancedb-parent</artifactId>
|
||||||
<version>0.27.0-beta.3</version>
|
<version>0.27.0-beta.2</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.lancedb</groupId>
|
<groupId>com.lancedb</groupId>
|
||||||
<artifactId>lancedb-parent</artifactId>
|
<artifactId>lancedb-parent</artifactId>
|
||||||
<version>0.27.0-beta.3</version>
|
<version>0.27.0-beta.2</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>${project.artifactId}</name>
|
<name>${project.artifactId}</name>
|
||||||
<description>LanceDB Java SDK Parent POM</description>
|
<description>LanceDB Java SDK Parent POM</description>
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "lancedb-nodejs"
|
name = "lancedb-nodejs"
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
version = "0.27.0-beta.3"
|
version = "0.27.0-beta.2"
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
description.workspace = true
|
description.workspace = true
|
||||||
repository.workspace = true
|
repository.workspace = true
|
||||||
|
|||||||
@@ -450,31 +450,6 @@ describe.each([arrow15, arrow16, arrow17, arrow18])(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
describe("delete", () => {
|
|
||||||
let tmpDir: tmp.DirResult;
|
|
||||||
let table: Table;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
tmpDir = tmp.dirSync({ unsafeCleanup: true });
|
|
||||||
const conn = await connect(tmpDir.name);
|
|
||||||
table = await conn.createTable("delete_test", [
|
|
||||||
{ id: 1, value: "a" },
|
|
||||||
{ id: 2, value: "b" },
|
|
||||||
{ id: 3, value: "c" },
|
|
||||||
{ id: 4, value: "d" },
|
|
||||||
{ id: 5, value: "e" },
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
afterEach(() => tmpDir.removeCallback());
|
|
||||||
|
|
||||||
test("returns num_deleted_rows", async () => {
|
|
||||||
const result = await table.delete("id > 3");
|
|
||||||
expect(result.numDeletedRows).toBe(2);
|
|
||||||
expect(result.version).toBe(2);
|
|
||||||
expect(await table.countRows()).toBe(3);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("merge insert", () => {
|
describe("merge insert", () => {
|
||||||
let tmpDir: tmp.DirResult;
|
let tmpDir: tmp.DirResult;
|
||||||
let table: Table;
|
let table: Table;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@lancedb/lancedb-darwin-arm64",
|
"name": "@lancedb/lancedb-darwin-arm64",
|
||||||
"version": "0.27.0-beta.3",
|
"version": "0.27.0-beta.2",
|
||||||
"os": ["darwin"],
|
"os": ["darwin"],
|
||||||
"cpu": ["arm64"],
|
"cpu": ["arm64"],
|
||||||
"main": "lancedb.darwin-arm64.node",
|
"main": "lancedb.darwin-arm64.node",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@lancedb/lancedb-linux-arm64-gnu",
|
"name": "@lancedb/lancedb-linux-arm64-gnu",
|
||||||
"version": "0.27.0-beta.3",
|
"version": "0.27.0-beta.2",
|
||||||
"os": ["linux"],
|
"os": ["linux"],
|
||||||
"cpu": ["arm64"],
|
"cpu": ["arm64"],
|
||||||
"main": "lancedb.linux-arm64-gnu.node",
|
"main": "lancedb.linux-arm64-gnu.node",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@lancedb/lancedb-linux-arm64-musl",
|
"name": "@lancedb/lancedb-linux-arm64-musl",
|
||||||
"version": "0.27.0-beta.3",
|
"version": "0.27.0-beta.2",
|
||||||
"os": ["linux"],
|
"os": ["linux"],
|
||||||
"cpu": ["arm64"],
|
"cpu": ["arm64"],
|
||||||
"main": "lancedb.linux-arm64-musl.node",
|
"main": "lancedb.linux-arm64-musl.node",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@lancedb/lancedb-linux-x64-gnu",
|
"name": "@lancedb/lancedb-linux-x64-gnu",
|
||||||
"version": "0.27.0-beta.3",
|
"version": "0.27.0-beta.2",
|
||||||
"os": ["linux"],
|
"os": ["linux"],
|
||||||
"cpu": ["x64"],
|
"cpu": ["x64"],
|
||||||
"main": "lancedb.linux-x64-gnu.node",
|
"main": "lancedb.linux-x64-gnu.node",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@lancedb/lancedb-linux-x64-musl",
|
"name": "@lancedb/lancedb-linux-x64-musl",
|
||||||
"version": "0.27.0-beta.3",
|
"version": "0.27.0-beta.2",
|
||||||
"os": ["linux"],
|
"os": ["linux"],
|
||||||
"cpu": ["x64"],
|
"cpu": ["x64"],
|
||||||
"main": "lancedb.linux-x64-musl.node",
|
"main": "lancedb.linux-x64-musl.node",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@lancedb/lancedb-win32-arm64-msvc",
|
"name": "@lancedb/lancedb-win32-arm64-msvc",
|
||||||
"version": "0.27.0-beta.3",
|
"version": "0.27.0-beta.2",
|
||||||
"os": [
|
"os": [
|
||||||
"win32"
|
"win32"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@lancedb/lancedb-win32-x64-msvc",
|
"name": "@lancedb/lancedb-win32-x64-msvc",
|
||||||
"version": "0.27.0-beta.3",
|
"version": "0.27.0-beta.2",
|
||||||
"os": ["win32"],
|
"os": ["win32"],
|
||||||
"cpu": ["x64"],
|
"cpu": ["x64"],
|
||||||
"main": "lancedb.win32-x64-msvc.node",
|
"main": "lancedb.win32-x64-msvc.node",
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@lancedb/lancedb",
|
"name": "@lancedb/lancedb",
|
||||||
"version": "0.27.0-beta.3",
|
"version": "0.27.0-beta.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@lancedb/lancedb",
|
"name": "@lancedb/lancedb",
|
||||||
"version": "0.27.0-beta.3",
|
"version": "0.27.0-beta.2",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64",
|
"x64",
|
||||||
"arm64"
|
"arm64"
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@
|
|||||||
"ann"
|
"ann"
|
||||||
],
|
],
|
||||||
"private": false,
|
"private": false,
|
||||||
"version": "0.27.0-beta.3",
|
"version": "0.27.0-beta.2",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./dist/index.js",
|
".": "./dist/index.js",
|
||||||
|
|||||||
@@ -753,14 +753,12 @@ impl From<lancedb::table::AddResult> for AddResult {
|
|||||||
|
|
||||||
#[napi(object)]
|
#[napi(object)]
|
||||||
pub struct DeleteResult {
|
pub struct DeleteResult {
|
||||||
pub num_deleted_rows: i64,
|
|
||||||
pub version: i64,
|
pub version: i64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<lancedb::table::DeleteResult> for DeleteResult {
|
impl From<lancedb::table::DeleteResult> for DeleteResult {
|
||||||
fn from(value: lancedb::table::DeleteResult) -> Self {
|
fn from(value: lancedb::table::DeleteResult) -> Self {
|
||||||
Self {
|
Self {
|
||||||
num_deleted_rows: value.num_deleted_rows as i64,
|
|
||||||
version: value.version as i64,
|
version: value.version as i64,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[tool.bumpversion]
|
[tool.bumpversion]
|
||||||
current_version = "0.30.0-beta.3"
|
current_version = "0.30.0-beta.2"
|
||||||
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*)\\.
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "lancedb-python"
|
name = "lancedb-python"
|
||||||
version = "0.30.0-beta.3"
|
version = "0.30.0-beta.2"
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
description = "Python bindings for LanceDB"
|
description = "Python bindings for LanceDB"
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ tests = [
|
|||||||
"polars>=0.19, <=1.3.0",
|
"polars>=0.19, <=1.3.0",
|
||||||
"tantivy",
|
"tantivy",
|
||||||
"pyarrow-stubs",
|
"pyarrow-stubs",
|
||||||
"pylance>=1.0.0b14,<3.0.0",
|
"pylance>=1.0.0b14",
|
||||||
"requests",
|
"requests",
|
||||||
"datafusion<52",
|
"datafusion<52",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1462,7 +1462,6 @@ class LanceFtsQueryBuilder(LanceQueryBuilder):
|
|||||||
self._phrase_query = False
|
self._phrase_query = False
|
||||||
self.ordering_field_name = ordering_field_name
|
self.ordering_field_name = ordering_field_name
|
||||||
self._reranker = None
|
self._reranker = None
|
||||||
self._fast_search = None
|
|
||||||
if isinstance(fts_columns, str):
|
if isinstance(fts_columns, str):
|
||||||
fts_columns = [fts_columns]
|
fts_columns = [fts_columns]
|
||||||
self._fts_columns = fts_columns
|
self._fts_columns = fts_columns
|
||||||
@@ -1484,19 +1483,6 @@ class LanceFtsQueryBuilder(LanceQueryBuilder):
|
|||||||
self._phrase_query = phrase_query
|
self._phrase_query = phrase_query
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def fast_search(self) -> LanceFtsQueryBuilder:
|
|
||||||
"""
|
|
||||||
Skip a flat search of unindexed data. This will improve
|
|
||||||
search performance but search results will not include unindexed data.
|
|
||||||
|
|
||||||
Returns
|
|
||||||
-------
|
|
||||||
LanceFtsQueryBuilder
|
|
||||||
The LanceFtsQueryBuilder object.
|
|
||||||
"""
|
|
||||||
self._fast_search = True
|
|
||||||
return self
|
|
||||||
|
|
||||||
def to_query_object(self) -> Query:
|
def to_query_object(self) -> Query:
|
||||||
return Query(
|
return Query(
|
||||||
columns=self._columns,
|
columns=self._columns,
|
||||||
@@ -1508,7 +1494,6 @@ class LanceFtsQueryBuilder(LanceQueryBuilder):
|
|||||||
query=self._query, columns=self._fts_columns
|
query=self._query, columns=self._fts_columns
|
||||||
),
|
),
|
||||||
offset=self._offset,
|
offset=self._offset,
|
||||||
fast_search=self._fast_search,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def output_schema(self) -> pa.Schema:
|
def output_schema(self) -> pa.Schema:
|
||||||
|
|||||||
@@ -1331,7 +1331,7 @@ class Table(ABC):
|
|||||||
1 2 [3.0, 4.0]
|
1 2 [3.0, 4.0]
|
||||||
2 3 [5.0, 6.0]
|
2 3 [5.0, 6.0]
|
||||||
>>> table.delete("x = 2")
|
>>> table.delete("x = 2")
|
||||||
DeleteResult(num_deleted_rows=1, version=2)
|
DeleteResult(version=2)
|
||||||
>>> table.to_pandas()
|
>>> table.to_pandas()
|
||||||
x vector
|
x vector
|
||||||
0 1 [1.0, 2.0]
|
0 1 [1.0, 2.0]
|
||||||
@@ -1345,7 +1345,7 @@ class Table(ABC):
|
|||||||
>>> to_remove
|
>>> to_remove
|
||||||
'1, 5'
|
'1, 5'
|
||||||
>>> table.delete(f"x IN ({to_remove})")
|
>>> table.delete(f"x IN ({to_remove})")
|
||||||
DeleteResult(num_deleted_rows=1, version=3)
|
DeleteResult(version=3)
|
||||||
>>> table.to_pandas()
|
>>> table.to_pandas()
|
||||||
x vector
|
x vector
|
||||||
0 3 [5.0, 6.0]
|
0 3 [5.0, 6.0]
|
||||||
@@ -4215,7 +4215,7 @@ class AsyncTable:
|
|||||||
1 2 [3.0, 4.0]
|
1 2 [3.0, 4.0]
|
||||||
2 3 [5.0, 6.0]
|
2 3 [5.0, 6.0]
|
||||||
>>> table.delete("x = 2")
|
>>> table.delete("x = 2")
|
||||||
DeleteResult(num_deleted_rows=1, version=2)
|
DeleteResult(version=2)
|
||||||
>>> table.to_pandas()
|
>>> table.to_pandas()
|
||||||
x vector
|
x vector
|
||||||
0 1 [1.0, 2.0]
|
0 1 [1.0, 2.0]
|
||||||
@@ -4229,7 +4229,7 @@ class AsyncTable:
|
|||||||
>>> to_remove
|
>>> to_remove
|
||||||
'1, 5'
|
'1, 5'
|
||||||
>>> table.delete(f"x IN ({to_remove})")
|
>>> table.delete(f"x IN ({to_remove})")
|
||||||
DeleteResult(num_deleted_rows=1, version=3)
|
DeleteResult(version=3)
|
||||||
>>> table.to_pandas()
|
>>> table.to_pandas()
|
||||||
x vector
|
x vector
|
||||||
0 3 [5.0, 6.0]
|
0 3 [5.0, 6.0]
|
||||||
|
|||||||
@@ -882,105 +882,3 @@ def test_fts_query_to_json():
|
|||||||
'"must_not":[]}}'
|
'"must_not":[]}}'
|
||||||
)
|
)
|
||||||
assert json_str == expected
|
assert json_str == expected
|
||||||
|
|
||||||
|
|
||||||
def test_fts_fast_search(table):
|
|
||||||
table.create_fts_index("text", use_tantivy=False)
|
|
||||||
|
|
||||||
# Insert some unindexed data
|
|
||||||
table.add(
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"text": "xyz",
|
|
||||||
"vector": [0 for _ in range(128)],
|
|
||||||
"id": 101,
|
|
||||||
"text2": "xyz",
|
|
||||||
"nested": {"text": "xyz"},
|
|
||||||
"count": 10,
|
|
||||||
}
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
# Without fast_search, the query object should not have fast_search set
|
|
||||||
builder = table.search("xyz", query_type="fts").limit(10)
|
|
||||||
query = builder.to_query_object()
|
|
||||||
assert query.fast_search is None
|
|
||||||
|
|
||||||
# With fast_search, the query object should have fast_search=True
|
|
||||||
builder = table.search("xyz", query_type="fts").fast_search().limit(10)
|
|
||||||
query = builder.to_query_object()
|
|
||||||
assert query.fast_search is True
|
|
||||||
|
|
||||||
# fast_search should be chainable with other methods
|
|
||||||
builder = (
|
|
||||||
table.search("xyz", query_type="fts").fast_search().select(["text"]).limit(5)
|
|
||||||
)
|
|
||||||
query = builder.to_query_object()
|
|
||||||
assert query.fast_search is True
|
|
||||||
assert query.limit == 5
|
|
||||||
assert query.columns == ["text"]
|
|
||||||
|
|
||||||
# Verify it executes without error and skips unindexed data
|
|
||||||
results = table.search("xyz", query_type="fts").fast_search().limit(5).to_list()
|
|
||||||
assert len(results) == 0
|
|
||||||
|
|
||||||
# Update index and verify it returns results
|
|
||||||
table.optimize()
|
|
||||||
results = table.search("xyz", query_type="fts").fast_search().limit(5).to_list()
|
|
||||||
assert len(results) > 0
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
|
||||||
async def test_fts_fast_search_async(async_table):
|
|
||||||
await async_table.create_index("text", config=FTS())
|
|
||||||
|
|
||||||
# Insert some unindexed data
|
|
||||||
await async_table.add(
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"text": "xyz",
|
|
||||||
"vector": [0 for _ in range(128)],
|
|
||||||
"id": 101,
|
|
||||||
"text2": "xyz",
|
|
||||||
"nested": {"text": "xyz"},
|
|
||||||
"count": 10,
|
|
||||||
}
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
# Without fast_search, should return results
|
|
||||||
results = await async_table.query().nearest_to_text("xyz").limit(5).to_list()
|
|
||||||
assert len(results) > 0
|
|
||||||
|
|
||||||
# With fast_search, should return no results data unindexed
|
|
||||||
fast_results = (
|
|
||||||
await async_table.query()
|
|
||||||
.nearest_to_text("xyz")
|
|
||||||
.fast_search()
|
|
||||||
.limit(5)
|
|
||||||
.to_list()
|
|
||||||
)
|
|
||||||
assert len(fast_results) == 0
|
|
||||||
|
|
||||||
# Update index and verify it returns results
|
|
||||||
await async_table.optimize()
|
|
||||||
|
|
||||||
fast_results = (
|
|
||||||
await async_table.query()
|
|
||||||
.nearest_to_text("xyz")
|
|
||||||
.fast_search()
|
|
||||||
.limit(5)
|
|
||||||
.to_list()
|
|
||||||
)
|
|
||||||
assert len(fast_results) > 0
|
|
||||||
|
|
||||||
# fast_search should be chainable with other methods
|
|
||||||
results = (
|
|
||||||
await async_table.query()
|
|
||||||
.nearest_to_text("xyz")
|
|
||||||
.fast_search()
|
|
||||||
.select(["text"])
|
|
||||||
.limit(5)
|
|
||||||
.to_list()
|
|
||||||
)
|
|
||||||
assert len(results) > 0
|
|
||||||
|
|||||||
+1
-6
@@ -112,24 +112,19 @@ impl From<lancedb::table::AddResult> for AddResult {
|
|||||||
#[pyclass(get_all)]
|
#[pyclass(get_all)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct DeleteResult {
|
pub struct DeleteResult {
|
||||||
pub num_deleted_rows: u64,
|
|
||||||
pub version: u64,
|
pub version: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pymethods]
|
#[pymethods]
|
||||||
impl DeleteResult {
|
impl DeleteResult {
|
||||||
pub fn __repr__(&self) -> String {
|
pub fn __repr__(&self) -> String {
|
||||||
format!(
|
format!("DeleteResult(version={})", self.version)
|
||||||
"DeleteResult(num_deleted_rows={}, version={})",
|
|
||||||
self.num_deleted_rows, self.version
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<lancedb::table::DeleteResult> for DeleteResult {
|
impl From<lancedb::table::DeleteResult> for DeleteResult {
|
||||||
fn from(result: lancedb::table::DeleteResult) -> Self {
|
fn from(result: lancedb::table::DeleteResult) -> Self {
|
||||||
Self {
|
Self {
|
||||||
num_deleted_rows: result.num_deleted_rows,
|
|
||||||
version: result.version,
|
version: result.version,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "lancedb"
|
name = "lancedb"
|
||||||
version = "0.27.0-beta.3"
|
version = "0.27.0-beta.2"
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
description = "LanceDB: A serverless, low-latency vector database for AI applications"
|
description = "LanceDB: A serverless, low-latency vector database for AI applications"
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
@@ -25,9 +25,9 @@ datafusion-catalog.workspace = true
|
|||||||
datafusion-common.workspace = true
|
datafusion-common.workspace = true
|
||||||
datafusion-execution.workspace = true
|
datafusion-execution.workspace = true
|
||||||
datafusion-expr.workspace = true
|
datafusion-expr.workspace = true
|
||||||
datafusion-functions.workspace = true
|
datafusion-functions = "51.0"
|
||||||
datafusion-physical-expr.workspace = true
|
datafusion-physical-expr.workspace = true
|
||||||
datafusion-sql.workspace = true
|
datafusion-sql = "51.0"
|
||||||
datafusion-physical-plan.workspace = true
|
datafusion-physical-plan.workspace = true
|
||||||
datafusion.workspace = true
|
datafusion.workspace = true
|
||||||
object_store = { workspace = true }
|
object_store = { workspace = true }
|
||||||
|
|||||||
@@ -1227,10 +1227,7 @@ impl<S: HttpSend> BaseTable for RemoteTable<S> {
|
|||||||
let body = response.text().await.err_to_http(request_id.clone())?;
|
let body = response.text().await.err_to_http(request_id.clone())?;
|
||||||
if body.trim().is_empty() {
|
if body.trim().is_empty() {
|
||||||
// Backward compatible with old servers
|
// Backward compatible with old servers
|
||||||
return Ok(DeleteResult {
|
return Ok(DeleteResult { version: 0 });
|
||||||
num_deleted_rows: 0,
|
|
||||||
version: 0,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
let delete_response: DeleteResult =
|
let delete_response: DeleteResult =
|
||||||
serde_json::from_str(&body).map_err(|e| Error::Http {
|
serde_json::from_str(&body).map_err(|e| Error::Http {
|
||||||
|
|||||||
@@ -7,9 +7,6 @@ use crate::Result;
|
|||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)]
|
||||||
pub struct DeleteResult {
|
pub struct DeleteResult {
|
||||||
/// The number of rows that were deleted.
|
|
||||||
#[serde(default)]
|
|
||||||
pub num_deleted_rows: u64,
|
|
||||||
// The commit version associated with the operation.
|
// The commit version associated with the operation.
|
||||||
// A version of `0` indicates compatibility with legacy servers that do not return
|
// A version of `0` indicates compatibility with legacy servers that do not return
|
||||||
/// a commit version.
|
/// a commit version.
|
||||||
@@ -23,14 +20,10 @@ pub struct DeleteResult {
|
|||||||
pub(crate) async fn execute_delete(table: &NativeTable, predicate: &str) -> Result<DeleteResult> {
|
pub(crate) async fn execute_delete(table: &NativeTable, predicate: &str) -> Result<DeleteResult> {
|
||||||
table.dataset.ensure_mutable()?;
|
table.dataset.ensure_mutable()?;
|
||||||
let mut dataset = (*table.dataset.get().await?).clone();
|
let mut dataset = (*table.dataset.get().await?).clone();
|
||||||
let delete_result = dataset.delete(predicate).await?;
|
dataset.delete(predicate).await?;
|
||||||
let num_deleted_rows = delete_result.num_deleted_rows;
|
|
||||||
let version = dataset.version().version;
|
let version = dataset.version().version;
|
||||||
table.dataset.update(dataset);
|
table.dataset.update(dataset);
|
||||||
Ok(DeleteResult {
|
Ok(DeleteResult { version })
|
||||||
num_deleted_rows,
|
|
||||||
version,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -115,32 +108,6 @@ mod tests {
|
|||||||
assert_eq!(current_schema, original_schema);
|
assert_eq!(current_schema, original_schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
|
||||||
async fn test_delete_returns_num_deleted_rows() {
|
|
||||||
let conn = connect("memory://").execute().await.unwrap();
|
|
||||||
let batch = record_batch!(("id", Int32, [1, 2, 3, 4, 5])).unwrap();
|
|
||||||
let table = conn
|
|
||||||
.create_table("test_num_deleted", batch)
|
|
||||||
.execute()
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
// Delete 2 rows (id > 3 means id=4 and id=5)
|
|
||||||
let result = table.delete("id > 3").await.unwrap();
|
|
||||||
assert_eq!(result.num_deleted_rows, 2);
|
|
||||||
assert_eq!(table.count_rows(None).await.unwrap(), 3);
|
|
||||||
|
|
||||||
// Delete 0 rows (no rows match)
|
|
||||||
let result = table.delete("id > 100").await.unwrap();
|
|
||||||
assert_eq!(result.num_deleted_rows, 0);
|
|
||||||
assert_eq!(table.count_rows(None).await.unwrap(), 3);
|
|
||||||
|
|
||||||
// Delete remaining rows
|
|
||||||
let result = table.delete("true").await.unwrap();
|
|
||||||
assert_eq!(result.num_deleted_rows, 3);
|
|
||||||
assert_eq!(table.count_rows(None).await.unwrap(), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_delete_false_increments_version() {
|
async fn test_delete_false_increments_version() {
|
||||||
let conn = connect("memory://").execute().await.unwrap();
|
let conn = connect("memory://").execute().await.unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user