diff --git a/Cargo.toml b/Cargo.toml index e8cac48e..24517b43 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,8 +5,8 @@ exclude = ["python"] resolver = "2" [workspace.dependencies] -lance = { "version" = "=0.7.4", "features" = ["dynamodb"] } -lance-linalg = { "version" = "=0.7.4" } +lance = { "version" = "=0.7.5", "features" = ["dynamodb"] } +lance-linalg = { "version" = "=0.7.5" } # Note that this one does not include pyarrow arrow = { version = "43.0.0", optional = false } arrow-array = "43.0" diff --git a/node/src/test/test.ts b/node/src/test/test.ts index 09d10e9b..c0d43543 100644 --- a/node/src/test/test.ts +++ b/node/src/test/test.ts @@ -19,7 +19,7 @@ import * as chaiAsPromised from 'chai-as-promised' import * as lancedb from '../index' import { type AwsCredentials, type EmbeddingFunction, MetricType, Query, WriteMode, DefaultWriteOptions, isWriteOptions } from '../index' -import { Field, Int32, makeVector, Schema, Utf8, Table as ArrowTable, vectorFromArray } from 'apache-arrow' +import { FixedSizeList, Field, Int32, makeVector, Schema, Utf8, Table as ArrowTable, vectorFromArray, Float32 } from 'apache-arrow' const expect = chai.expect const assert = chai.assert @@ -258,6 +258,36 @@ describe('LanceDB client', function () { }) }) + describe('when searching an empty dataset', function () { + it('should not fail', async function () { + const dir = await track().mkdir('lancejs') + const con = await lancedb.connect(dir) + + const schema = new Schema( + [new Field('vector', new FixedSizeList(128, new Field('float32', new Float32())))] + ) + const table = await con.createTable({ name: 'vectors', schema }) + const result = await table.search(Array(128).fill(0.1)).execute() + assert.isEmpty(result) + }) + }) + + describe('when searching an empty-after-delete dataset', function () { + it('should not fail', async function () { + const dir = await track().mkdir('lancejs') + const con = await lancedb.connect(dir) + + const schema = new Schema( + [new Field('vector', new FixedSizeList(128, new Field('float32', new Float32())))] + ) + const table = await con.createTable({ name: 'vectors', schema }) + await table.add([{ vector: Array(128).fill(0.1) }]) + await table.delete('vector IS NOT NULL') + const result = await table.search(Array(128).fill(0.1)).execute() + assert.isEmpty(result) + }) + }) + describe('when creating a vector index', function () { it('overwrite all records in a table', async function () { const uri = await createTestDB(32, 300)