Merge main and align cosine fix with Lance beta.25

This commit is contained in:
Gatefixer
2026-11-17 09:31:14 +00:00
31 changed files with 725 additions and 138 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
[tool.bumpversion]
current_version = "0.42.0-beta.17"
current_version = "0.42.0-beta.18"
parse = """(?x)
(?P<major>0|[1-9]\\d*)\\.
(?P<minor>0|[1-9]\\d*)\\.
+7
View File
@@ -311,10 +311,16 @@ jobs:
with:
fetch-depth: 0
lfs: true
- uses: actions/setup-python@v6
id: python
with:
python-version: "3.13"
- name: CPU features
run: sysctl -a | grep cpu
- uses: Swatinem/rust-cache@v2
with:
# PyO3 caches the interpreter library path; runner images can differ.
key: ${{ matrix.mac-runner }}-python-${{ steps.python.outputs.python-version }}
# Restore everywhere, but only save from main. Per-PR saves are
# unreadable outside their own branch anyway, since GitHub scopes
# caches to the creating ref.
@@ -323,6 +329,7 @@ jobs:
run: brew install protobuf
- name: Run tests
env:
PYO3_PYTHON: ${{ steps.python.outputs.python-path }}
CARGO_TEST_TARGETS: ${{ matrix.phase == 'doc' && '--doc' || '--lib --tests' }}
run: |
# Don't run the s3 integration tests since docker isn't available
Generated
+51 -51
View File
@@ -3885,8 +3885,8 @@ checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c"
[[package]]
name = "fsst"
version = "15.0.0-beta.23"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.23#f7ef212132c52f9704c387f342a7ff49a9ebf908"
version = "15.0.0-beta.25"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.25#f5dbd55dd79f1f0412f897ed1917128300fb8c1a"
dependencies = [
"arrow-array",
"rand 0.9.5",
@@ -5364,8 +5364,8 @@ checksum = "e037a2e1d8d5fdbd49b16a4ea09d5d6401c1f29eca5ff29d03d3824dba16256a"
[[package]]
name = "lance"
version = "15.0.0-beta.23"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.23#f7ef212132c52f9704c387f342a7ff49a9ebf908"
version = "15.0.0-beta.25"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.25#f5dbd55dd79f1f0412f897ed1917128300fb8c1a"
dependencies = [
"arc-swap",
"arrow",
@@ -5440,8 +5440,8 @@ dependencies = [
[[package]]
name = "lance-arrow"
version = "15.0.0-beta.23"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.23#f7ef212132c52f9704c387f342a7ff49a9ebf908"
version = "15.0.0-beta.25"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.25#f5dbd55dd79f1f0412f897ed1917128300fb8c1a"
dependencies = [
"arrow-array",
"arrow-buffer",
@@ -5463,7 +5463,7 @@ dependencies = [
[[package]]
name = "lance-arrow-scalar"
version = "59.0.0"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.23#f7ef212132c52f9704c387f342a7ff49a9ebf908"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.25#f5dbd55dd79f1f0412f897ed1917128300fb8c1a"
dependencies = [
"arrow-array",
"arrow-buffer",
@@ -5477,7 +5477,7 @@ dependencies = [
[[package]]
name = "lance-arrow-stats"
version = "59.0.0"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.23#f7ef212132c52f9704c387f342a7ff49a9ebf908"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.25#f5dbd55dd79f1f0412f897ed1917128300fb8c1a"
dependencies = [
"arrow-array",
"arrow-schema",
@@ -5486,8 +5486,8 @@ dependencies = [
[[package]]
name = "lance-bitpacking"
version = "15.0.0-beta.23"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.23#f7ef212132c52f9704c387f342a7ff49a9ebf908"
version = "15.0.0-beta.25"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.25#f5dbd55dd79f1f0412f897ed1917128300fb8c1a"
dependencies = [
"arrayref",
"crunchy",
@@ -5497,8 +5497,8 @@ dependencies = [
[[package]]
name = "lance-core"
version = "15.0.0-beta.23"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.23#f7ef212132c52f9704c387f342a7ff49a9ebf908"
version = "15.0.0-beta.25"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.25#f5dbd55dd79f1f0412f897ed1917128300fb8c1a"
dependencies = [
"arrow-array",
"arrow-buffer",
@@ -5536,8 +5536,8 @@ dependencies = [
[[package]]
name = "lance-datafusion"
version = "15.0.0-beta.23"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.23#f7ef212132c52f9704c387f342a7ff49a9ebf908"
version = "15.0.0-beta.25"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.25#f5dbd55dd79f1f0412f897ed1917128300fb8c1a"
dependencies = [
"arrow",
"arrow-array",
@@ -5568,8 +5568,8 @@ dependencies = [
[[package]]
name = "lance-datafusion-exec"
version = "15.0.0-beta.23"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.23#f7ef212132c52f9704c387f342a7ff49a9ebf908"
version = "15.0.0-beta.25"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.25#f5dbd55dd79f1f0412f897ed1917128300fb8c1a"
dependencies = [
"arrow",
"arrow-array",
@@ -5594,8 +5594,8 @@ dependencies = [
[[package]]
name = "lance-datagen"
version = "15.0.0-beta.23"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.23#f7ef212132c52f9704c387f342a7ff49a9ebf908"
version = "15.0.0-beta.25"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.25#f5dbd55dd79f1f0412f897ed1917128300fb8c1a"
dependencies = [
"arrow",
"arrow-array",
@@ -5612,8 +5612,8 @@ dependencies = [
[[package]]
name = "lance-derive"
version = "15.0.0-beta.23"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.23#f7ef212132c52f9704c387f342a7ff49a9ebf908"
version = "15.0.0-beta.25"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.25#f5dbd55dd79f1f0412f897ed1917128300fb8c1a"
dependencies = [
"proc-macro2",
"quote",
@@ -5622,8 +5622,8 @@ dependencies = [
[[package]]
name = "lance-encoding"
version = "15.0.0-beta.23"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.23#f7ef212132c52f9704c387f342a7ff49a9ebf908"
version = "15.0.0-beta.25"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.25#f5dbd55dd79f1f0412f897ed1917128300fb8c1a"
dependencies = [
"arrow-arith",
"arrow-array",
@@ -5657,8 +5657,8 @@ dependencies = [
[[package]]
name = "lance-file"
version = "15.0.0-beta.23"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.23#f7ef212132c52f9704c387f342a7ff49a9ebf908"
version = "15.0.0-beta.25"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.25#f5dbd55dd79f1f0412f897ed1917128300fb8c1a"
dependencies = [
"arrow-arith",
"arrow-array",
@@ -5689,8 +5689,8 @@ dependencies = [
[[package]]
name = "lance-geo"
version = "15.0.0-beta.23"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.23#f7ef212132c52f9704c387f342a7ff49a9ebf908"
version = "15.0.0-beta.25"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.25#f5dbd55dd79f1f0412f897ed1917128300fb8c1a"
dependencies = [
"arrow-array",
"arrow-schema",
@@ -5721,8 +5721,8 @@ dependencies = [
[[package]]
name = "lance-index"
version = "15.0.0-beta.23"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.23#f7ef212132c52f9704c387f342a7ff49a9ebf908"
version = "15.0.0-beta.25"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.25#f5dbd55dd79f1f0412f897ed1917128300fb8c1a"
dependencies = [
"arc-swap",
"arrow",
@@ -5795,8 +5795,8 @@ dependencies = [
[[package]]
name = "lance-index-core"
version = "15.0.0-beta.23"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.23#f7ef212132c52f9704c387f342a7ff49a9ebf908"
version = "15.0.0-beta.25"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.25#f5dbd55dd79f1f0412f897ed1917128300fb8c1a"
dependencies = [
"arrow-array",
"arrow-schema",
@@ -5819,8 +5819,8 @@ dependencies = [
[[package]]
name = "lance-io"
version = "15.0.0-beta.23"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.23#f7ef212132c52f9704c387f342a7ff49a9ebf908"
version = "15.0.0-beta.25"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.25#f5dbd55dd79f1f0412f897ed1917128300fb8c1a"
dependencies = [
"arrow",
"arrow-array",
@@ -5865,8 +5865,8 @@ dependencies = [
[[package]]
name = "lance-jsonb"
version = "15.0.0-beta.23"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.23#f7ef212132c52f9704c387f342a7ff49a9ebf908"
version = "15.0.0-beta.25"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.25#f5dbd55dd79f1f0412f897ed1917128300fb8c1a"
dependencies = [
"byteorder",
"ethnum",
@@ -5883,7 +5883,7 @@ dependencies = [
[[package]]
name = "lance-linalg"
version = "15.0.0-beta.23"
version = "15.0.0-beta.25"
dependencies = [
"approx",
"argminmax 0.7.1",
@@ -5905,8 +5905,8 @@ dependencies = [
[[package]]
name = "lance-namespace"
version = "15.0.0-beta.23"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.23#f7ef212132c52f9704c387f342a7ff49a9ebf908"
version = "15.0.0-beta.25"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.25#f5dbd55dd79f1f0412f897ed1917128300fb8c1a"
dependencies = [
"arrow",
"async-trait",
@@ -5920,8 +5920,8 @@ dependencies = [
[[package]]
name = "lance-namespace-impls"
version = "15.0.0-beta.23"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.23#f7ef212132c52f9704c387f342a7ff49a9ebf908"
version = "15.0.0-beta.25"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.25#f5dbd55dd79f1f0412f897ed1917128300fb8c1a"
dependencies = [
"arc-swap",
"arrow",
@@ -5975,8 +5975,8 @@ dependencies = [
[[package]]
name = "lance-select"
version = "15.0.0-beta.23"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.23#f7ef212132c52f9704c387f342a7ff49a9ebf908"
version = "15.0.0-beta.25"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.25#f5dbd55dd79f1f0412f897ed1917128300fb8c1a"
dependencies = [
"arrow-array",
"arrow-buffer",
@@ -5990,8 +5990,8 @@ dependencies = [
[[package]]
name = "lance-table"
version = "15.0.0-beta.23"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.23#f7ef212132c52f9704c387f342a7ff49a9ebf908"
version = "15.0.0-beta.25"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.25#f5dbd55dd79f1f0412f897ed1917128300fb8c1a"
dependencies = [
"arrow",
"arrow-array",
@@ -6032,8 +6032,8 @@ dependencies = [
[[package]]
name = "lance-testing"
version = "15.0.0-beta.23"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.23#f7ef212132c52f9704c387f342a7ff49a9ebf908"
version = "15.0.0-beta.25"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.25#f5dbd55dd79f1f0412f897ed1917128300fb8c1a"
dependencies = [
"arrow-array",
"arrow-schema",
@@ -6046,8 +6046,8 @@ dependencies = [
[[package]]
name = "lance-tokenizer"
version = "15.0.0-beta.23"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.23#f7ef212132c52f9704c387f342a7ff49a9ebf908"
version = "15.0.0-beta.25"
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.25#f5dbd55dd79f1f0412f897ed1917128300fb8c1a"
dependencies = [
"frostem",
"icu_segmenter",
@@ -6060,7 +6060,7 @@ dependencies = [
[[package]]
name = "lancedb"
version = "0.42.0-beta.17"
version = "0.42.0-beta.18"
dependencies = [
"ahash",
"anyhow",
@@ -6171,7 +6171,7 @@ dependencies = [
[[package]]
name = "lancedb-cli"
version = "0.42.0-beta.17"
version = "0.42.0-beta.18"
dependencies = [
"anyhow",
"arrow-array",
@@ -6214,7 +6214,7 @@ dependencies = [
[[package]]
name = "lancedb-nodejs"
version = "0.42.0-beta.17"
version = "0.42.0-beta.18"
dependencies = [
"arrow-array",
"arrow-buffer",
@@ -6239,7 +6239,7 @@ dependencies = [
[[package]]
name = "lancedb-python"
version = "0.42.0-beta.17"
version = "0.42.0-beta.18"
dependencies = [
"arc-swap",
"arrow",
+14 -14
View File
@@ -20,20 +20,20 @@ categories = ["database-implementations"]
rust-version = "1.95.0"
[workspace.dependencies]
lance = { "version" = "=15.0.0-beta.23", default-features = false, "tag" = "v15.0.0-beta.23", "git" = "https://github.com/lance-format/lance.git" }
lance-core = { "version" = "=15.0.0-beta.23", "tag" = "v15.0.0-beta.23", "git" = "https://github.com/lance-format/lance.git" }
lance-datagen = { "version" = "=15.0.0-beta.23", "tag" = "v15.0.0-beta.23", "git" = "https://github.com/lance-format/lance.git" }
lance-file = { "version" = "=15.0.0-beta.23", "tag" = "v15.0.0-beta.23", "git" = "https://github.com/lance-format/lance.git" }
lance-io = { "version" = "=15.0.0-beta.23", default-features = false, "tag" = "v15.0.0-beta.23", "git" = "https://github.com/lance-format/lance.git" }
lance-index = { "version" = "=15.0.0-beta.23", "tag" = "v15.0.0-beta.23", "git" = "https://github.com/lance-format/lance.git" }
lance-jsonb = { "version" = "=15.0.0-beta.23", "tag" = "v15.0.0-beta.23", "git" = "https://github.com/lance-format/lance.git" }
lance-namespace = { "version" = "=15.0.0-beta.23", "tag" = "v15.0.0-beta.23", "git" = "https://github.com/lance-format/lance.git" }
lance-namespace-impls = { "version" = "=15.0.0-beta.23", default-features = false, "tag" = "v15.0.0-beta.23", "git" = "https://github.com/lance-format/lance.git" }
lance-table = { "version" = "=15.0.0-beta.23", "tag" = "v15.0.0-beta.23", "git" = "https://github.com/lance-format/lance.git" }
lance-testing = { "version" = "=15.0.0-beta.23", "tag" = "v15.0.0-beta.23", "git" = "https://github.com/lance-format/lance.git" }
lance-datafusion = { "version" = "=15.0.0-beta.23", "tag" = "v15.0.0-beta.23", "git" = "https://github.com/lance-format/lance.git" }
lance-encoding = { "version" = "=15.0.0-beta.23", "tag" = "v15.0.0-beta.23", "git" = "https://github.com/lance-format/lance.git" }
lance-arrow = { "version" = "=15.0.0-beta.23", "tag" = "v15.0.0-beta.23", "git" = "https://github.com/lance-format/lance.git" }
lance = { "version" = "=15.0.0-beta.25", default-features = false, "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-core = { "version" = "=15.0.0-beta.25", "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-datagen = { "version" = "=15.0.0-beta.25", "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-file = { "version" = "=15.0.0-beta.25", "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-io = { "version" = "=15.0.0-beta.25", default-features = false, "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-index = { "version" = "=15.0.0-beta.25", "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-jsonb = { "version" = "=15.0.0-beta.25", "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-namespace = { "version" = "=15.0.0-beta.25", "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-namespace-impls = { "version" = "=15.0.0-beta.25", default-features = false, "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-table = { "version" = "=15.0.0-beta.25", "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-testing = { "version" = "=15.0.0-beta.25", "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-datafusion = { "version" = "=15.0.0-beta.25", "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-encoding = { "version" = "=15.0.0-beta.25", "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-arrow = { "version" = "=15.0.0-beta.25", "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lancedb = { path = "rust/lancedb", default-features = false }
ahash = "0.8"
anyhow = "1"
+1 -1
View File
@@ -14,7 +14,7 @@ Add the following dependency to your `pom.xml`:
<dependency>
<groupId>com.lancedb</groupId>
<artifactId>lancedb-core</artifactId>
<version>0.42.0-beta.17</version>
<version>0.42.0-beta.18</version>
</dependency>
```
+30 -5
View File
@@ -517,11 +517,36 @@ def probe_library(name: str) -> str:
return native_diagnostics.find_library(name)
```
Captured literal globals support `None`, booleans, integers, strings, bytes,
finite floats, and tuples of these values. Construct other objects, including
PyArrow types and schemas, inside the Function or helper module instead. Values
used only in the decorator's `input_schema` or `output_schema` are not captured
globals and can be defined outside the Function.
Captured globals are copied into the Function's source. They can be `None`,
booleans, integers, strings, bytes, and finite floats; tuples, lists, dicts,
sets, and frozensets of supported values; PyArrow data types, fields, and
schemas; and NumPy arrays and scalars of bool, integer, `float16`, `float32`,
and `float64` dtypes. The copy is taken when the decorator runs and rebuilt in
each worker process, so later changes on either side are not shared. NumPy
values need `numpy` in the remote environment; declare it with `pip=` or
`conda=`. Each value is limited to 1 MiB of source and 32 levels of nesting;
load larger data inside the Function, for example from a table or a package
resource shipped with `code=`. Construct other objects inside the Function or
helper module instead. Values used only in the decorator's `input_schema` or
`output_schema` are not captured globals and can be defined outside the
Function.
```python
import pyarrow as pa
from lancedb import function
LABELS = {"pick": 0, "place": 1}
RESULT = pa.struct([pa.field("label", pa.string()), pa.field("id", pa.int32())])
@function(
input_schema=pa.schema([pa.field("action", pa.string(), nullable=False)]),
output_schema=pa.field("result", RESULT, nullable=False),
)
def label(action: pa.Array) -> pa.Array:
rows = [{"label": name, "id": LABELS[name]} for name in action.to_pylist()]
return pa.array(rows, type=RESULT)
```
Annotate a blob input with `lancedb.BlobReader` for lazy, seekable access, or
with `bytes` to materialize its contents before the Function runs. Reader
+1 -1
View File
@@ -8,7 +8,7 @@
<parent>
<groupId>com.lancedb</groupId>
<artifactId>lancedb-parent</artifactId>
<version>0.42.0-beta.17</version>
<version>0.42.0-beta.18</version>
<relativePath>../pom.xml</relativePath>
</parent>
+2 -2
View File
@@ -6,7 +6,7 @@
<groupId>com.lancedb</groupId>
<artifactId>lancedb-parent</artifactId>
<version>0.42.0-beta.17</version>
<version>0.42.0-beta.18</version>
<packaging>pom</packaging>
<name>${project.artifactId}</name>
<description>LanceDB Java SDK Parent POM</description>
@@ -28,7 +28,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<arrow.version>15.0.0</arrow.version>
<lance-core.version>15.0.0-beta.23</lance-core.version>
<lance-core.version>15.0.0-beta.25</lance-core.version>
<jackson.version>2.18.12</jackson.version>
<spotless.skip>false</spotless.skip>
<spotless.version>2.30.0</spotless.version>
+1 -1
View File
@@ -1,7 +1,7 @@
[package]
name = "lancedb-nodejs"
edition.workspace = true
version = "0.42.0-beta.17"
version = "0.42.0-beta.18"
publish = false
license.workspace = true
description.workspace = true
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@lancedb/lancedb-darwin-arm64",
"version": "0.42.0-beta.17",
"version": "0.42.0-beta.18",
"os": ["darwin"],
"cpu": ["arm64"],
"main": "lancedb.darwin-arm64.node",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@lancedb/lancedb-linux-arm64-gnu",
"version": "0.42.0-beta.17",
"version": "0.42.0-beta.18",
"os": ["linux"],
"cpu": ["arm64"],
"main": "lancedb.linux-arm64-gnu.node",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@lancedb/lancedb-linux-arm64-musl",
"version": "0.42.0-beta.17",
"version": "0.42.0-beta.18",
"os": ["linux"],
"cpu": ["arm64"],
"main": "lancedb.linux-arm64-musl.node",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@lancedb/lancedb-linux-x64-gnu",
"version": "0.42.0-beta.17",
"version": "0.42.0-beta.18",
"os": ["linux"],
"cpu": ["x64"],
"main": "lancedb.linux-x64-gnu.node",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@lancedb/lancedb-linux-x64-musl",
"version": "0.42.0-beta.17",
"version": "0.42.0-beta.18",
"os": ["linux"],
"cpu": ["x64"],
"main": "lancedb.linux-x64-musl.node",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@lancedb/lancedb-win32-arm64-msvc",
"version": "0.42.0-beta.17",
"version": "0.42.0-beta.18",
"os": [
"win32"
],
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@lancedb/lancedb-win32-x64-msvc",
"version": "0.42.0-beta.17",
"version": "0.42.0-beta.18",
"os": ["win32"],
"cpu": ["x64"],
"main": "lancedb.win32-x64-msvc.node",
+1 -1
View File
@@ -11,7 +11,7 @@
"ann"
],
"private": false,
"version": "0.42.0-beta.17",
"version": "0.42.0-beta.18",
"main": "dist/index.js",
"exports": {
".": "./dist/index.js",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "lancedb-python"
version = "0.42.0-beta.17"
version = "0.42.0-beta.18"
publish = false
edition.workspace = true
description = "Python bindings for LanceDB"
+1 -1
View File
@@ -64,7 +64,7 @@ tests = [
"polars>=0.19, <=1.32.3",
"pyarrow>=16",
"pyarrow-stubs>=16.0",
"pylance==15.0.0b23",
"pylance==15.0.0b25",
"requests>=2.31.0",
"datafusion>=54,<55",
"opentelemetry-sdk>=1.30.0",
+210 -27
View File
@@ -1859,24 +1859,42 @@ def _is_function_decorator(node: ast.expr) -> bool:
)
def _literal_source(value: Any, name: str) -> str:
if value is None or type(value) in (bool, int, str, bytes):
return repr(value)
if type(value) is float and math.isfinite(value):
return repr(value)
if type(value) is tuple:
children = ", ".join(_literal_source(child, name) for child in value)
if len(value) == 1:
children += ","
return f"({children})"
raise TypeError(
# A captured value is inlined into the artifact source; larger data belongs in a
# table or a package resource.
_MAX_CAPTURED_SOURCE = 1024 * 1024
# Far below CPython's parser nesting limit.
_MAX_CAPTURED_DEPTH = 32
_CAPTURE_REMEDY = "Define this value inside the function or class body instead."
def _unsupported_capture(name: str, kind: str) -> TypeError:
return TypeError(
"Function source references an unsupported global value of type "
f"{type(value).__name__} in {name!r}. Only None, bool, int, str, bytes, "
"finite float, and tuples of these literals can be captured. "
"Define this value inside the function or class body instead."
f"{kind} in {name!r}. Captured globals can be None, bool, int, str, "
"bytes, or finite float values; tuples, lists, dicts, sets, or frozensets "
"of supported values; PyArrow data types, fields, or schemas; or NumPy "
"arrays or scalars of bool, integer, float16, float32, or float64 dtypes. "
+ _CAPTURE_REMEDY
)
def _python_extension_type(data_type: pa.DataType) -> Optional[pa.ExtensionType]:
"""The first extension type within `data_type` whose class is defined in
Python. IPC carries only its name, so it deserializes as the storage type
wherever that class is not registered."""
if isinstance(data_type, pa.ExtensionType):
return data_type
if isinstance(data_type, pa.BaseExtensionType):
return _python_extension_type(data_type.storage_type)
if isinstance(data_type, pa.DictionaryType):
return _python_extension_type(data_type.value_type)
for index in range(data_type.num_fields):
found = _python_extension_type(data_type.field(index).type)
if found is not None:
return found
return None
_DYNAMIC_NAMESPACE_ACCESS = frozenset(
{"globals", "locals", "vars", "eval", "exec", "compile", "__import__"}
)
@@ -2175,7 +2193,7 @@ class _SourcePackager:
The module holds the definition plus exactly the module-level names it
references: modules as imports, importable classes and functions as
imports, literals inline, and functions and classes defined in
imports, captured values inline, and functions and classes defined in
``__main__`` by source, recursively, dependencies first.
"""
@@ -2183,6 +2201,7 @@ class _SourcePackager:
self._code_modules = code_modules
self._requirements = requirements
self._imports: dict[str, str] = {}
self._support_imports: dict[str, str] = {}
self._definitions: list[str] = []
self._packaged: set[int] = set()
self._names: dict[str, Any] = {}
@@ -2191,8 +2210,13 @@ class _SourcePackager:
def package(self, target: Any, signature: FunctionSignature) -> str:
entry = self._definition(target, entry=True, signature=signature)
parts = [_SOURCE_HEADER]
if self._imports:
parts.extend(["", *(self._imports[name] for name in sorted(self._imports))])
# Captured values are rebuilt with the support modules, so those come first.
imports = [
*(self._support_imports[alias] for alias in sorted(self._support_imports)),
*(self._imports[name] for name in sorted(self._imports)),
]
if imports:
parts.extend(["", *imports])
for definition in self._definitions:
parts.extend(["", definition])
parts.extend(["", entry, ""])
@@ -2313,8 +2337,8 @@ class _SourcePackager:
def _global_source(self, name: str, value: Any) -> str:
"""One module-level line that rebinds `name` to `value` in the artifact:
an import for modules and importable classes/functions, a literal
otherwise."""
an import for modules and importable classes/functions, a captured
copy otherwise."""
if value is BlobReader:
return f"from lance_blob import BlobReader as {name}"
if isinstance(value, types.ModuleType):
@@ -2347,7 +2371,149 @@ class _SourcePackager:
if imported is value:
self._require_importable(module_name)
return f"from {module_name} import {qualname} as {name}"
return f"{name} = {_literal_source(value, name)}"
return f"{name} = {self._captured_source(name, value)}"
def _captured_source(self, name: str, value: Any) -> str:
"""An expression that rebuilds a copy of the global `name`.
Literals and containers are written as Python literals, with set
elements sorted by their source so the artifact does not depend on hash
randomization. Arrow values are rebuilt from Arrow's IPC schema encoding
and NumPy values from their dtype and elements.
"""
remaining = _MAX_CAPTURED_SOURCE
enclosing: set[int] = set()
def too_large() -> ValueError:
return ValueError(
f"Function global {name!r} is too large to capture: its source "
f"exceeds {_MAX_CAPTURED_SOURCE} characters. Load large data inside "
"the function or class body instead, for example from a table or a "
"package resource shipped with code=."
)
def charge(source: str, nested: Sequence[str] = ()) -> str:
nonlocal remaining
remaining -= len(source) - sum(map(len, nested))
if remaining < 0:
raise too_large()
return source
def emit(value: Any) -> str:
if value is None or type(value) in (bool, int, str, bytes):
return charge(repr(value))
if type(value) is float and math.isfinite(value):
return charge(repr(value))
if isinstance(value, (pa.DataType, pa.Field, pa.Schema)):
return charge(self._arrow_source(name, value))
numpy = sys.modules.get("numpy")
if numpy is not None and (
type(value) is numpy.ndarray or isinstance(value, numpy.generic)
):
return emit_numpy(numpy, value)
if type(value) in (tuple, list, dict, set, frozenset):
return emit_container(value)
raise _unsupported_capture(name, type(value).__name__)
def emit_numpy(numpy: types.ModuleType, value: Any) -> str:
# These convert to exact Python values; longdouble stays a NumPy scalar.
if value.dtype.kind not in "biuf" or value.dtype.type is numpy.longdouble:
raise _unsupported_capture(
name, f"{type(value).__name__} with dtype {value.dtype}"
)
# Every element takes at least one character; check before tolist().
if value.size > remaining:
raise too_large()
alias = self._support_module("numpy")
dtype = repr(value.dtype.str)
if isinstance(value, numpy.generic):
item = emit(value.item())
return charge(f"{alias}.dtype({dtype}).type({item})", (item,))
if value.size == 0:
return charge(
f"{alias}.array([], dtype={dtype}).reshape({value.shape!r})"
)
elements = emit(value.tolist())
source = f"{alias}.array({elements}, dtype={dtype})"
return charge(source, (elements,))
def emit_container(value: Any) -> str:
if id(value) in enclosing:
raise ValueError(
f"Function global {name!r} contains itself and cannot be "
"captured. " + _CAPTURE_REMEDY
)
if len(enclosing) == _MAX_CAPTURED_DEPTH:
raise ValueError(
f"Function global {name!r} nests containers more than "
f"{_MAX_CAPTURED_DEPTH} levels deep and cannot be captured. "
+ _CAPTURE_REMEDY
)
enclosing.add(id(value))
if type(value) is dict:
entries = [(emit(key), emit(child)) for key, child in value.items()]
children = [part for entry in entries for part in entry]
listed = ", ".join(f"{key}: {child}" for key, child in entries)
source = f"{{{listed}}}"
else:
children = [emit(child) for child in value]
if type(value) in (set, frozenset):
listed = ", ".join(sorted(children))
else:
listed = ", ".join(children)
if type(value) is tuple:
source = f"({listed},)" if len(children) == 1 else f"({listed})"
elif type(value) is list:
source = f"[{listed}]"
elif type(value) is set:
source = (
f"{{{listed}}}" if children else f"{self._builtin('set')}()"
)
else:
items = f"{{{listed}}}" if children else ""
source = f"{self._builtin('frozenset')}({items})"
enclosing.remove(id(value))
return charge(source, children)
return emit(value)
def _arrow_source(
self, name: str, value: Union[pa.DataType, pa.Field, pa.Schema]
) -> str:
if isinstance(value, pa.Schema):
schema, suffix = value, ""
elif isinstance(value, pa.Field):
schema, suffix = pa.schema([value]), ".field(0)"
else:
schema, suffix = pa.schema([pa.field("", value)]), ".field(0).type"
for data_type in schema.types:
extension = _python_extension_type(data_type)
if extension is not None:
raise TypeError(
f"Function global {name!r} uses the Arrow extension type "
f"{extension.extension_name!r}, which is defined in Python and "
"cannot be captured. " + _CAPTURE_REMEDY
)
alias = self._support_module("pyarrow")
# Schema IPC keeps nullability, metadata, and nested fields exactly.
data = schema.serialize().to_pybytes()
return f"{alias}.ipc.read_schema({alias}.py_buffer({data!r})){suffix}"
def _support_module(self, module: str) -> str:
"""The artifact's private alias for a module that rebuilds captured
values."""
alias = f"_lancedb_{module}"
if alias not in self._support_imports:
self._require_importable(module)
self._claim(alias, ("support", module))
self._support_imports[alias] = f"import {module} as {alias}"
return alias
def _builtin(self, name: str) -> str:
"""A builtin called by captured source, which the artifact must not
rebind."""
self._claim(name, ("builtin", name))
return name
def _require_importable(self, module_name: str) -> None:
"""Warn about an import the Function's environment may not be able to
@@ -3015,8 +3181,11 @@ def function(
- modules, and classes and functions importable from an installed
package, become imports; the package must be declared in ``pip`` or
``conda``;
- literals (``None``, ``bool``, ``int``, ``str``, ``bytes``, finite
``float``, and tuples containing only these literals) are inlined;
- values are copied into the source: ``None``, ``bool``, ``int``,
``str``, ``bytes``, and finite ``float``; tuples, lists, dicts, sets,
and frozensets of supported values; PyArrow data types, fields, and
schemas; and NumPy arrays and scalars of ``bool``, integer,
``float16``, ``float32``, and ``float64`` dtypes;
- functions and classes defined in ``__main__``, such as notebook cells,
are packaged by source, together with what they reference;
- modules and packages listed in ``code`` are shipped as Python source and
@@ -3034,13 +3203,27 @@ def function(
image. Warnings follow normal Python warning filters and may be promoted
to errors. Declare every third-party import in ``pip`` or ``conda`` even
when it happens to be installed on the registration host.
Other global values, including Arrow types and schemas, lists, dictionaries,
sets, and NumPy arrays, cannot be captured as literals. Define them inside
the function or class body instead.
Closures, lambdas, nested definitions, mutable module-level objects, and a
non-standard ``__builtins__`` are rejected where they can be seen and
Closures, lambdas, nested definitions, other mutable module-level objects,
and a non-standard ``__builtins__`` are rejected where they can be seen and
otherwise unsupported.
**Captured values.** A captured value is copied when the decorator runs
and rebuilt in every worker process. Later changes on the client do not
reach the Function, changes a worker makes stay in that process, and
globals that share an object on the client become separate copies.
Dictionaries keep their insertion order and set elements are written in a
canonical order, so the same values always package to the same source.
Floats, including NumPy elements, must be finite. Arrow values are rebuilt
from Arrow's IPC schema encoding, which preserves nullability, metadata,
and nested fields; extension types defined in Python cannot be captured.
NumPy values keep their dtype and shape and need ``numpy`` in the remote
environment, so declare it in ``pip`` or ``conda``. Each captured value is
limited to 1 MiB of source and 32 levels of nesting, and cannot contain
itself. Load larger data inside the function or class body, for example
from a table or a package resource shipped with ``code``. Define other
values, such as instances of your own classes, inside the function or
class body as well.
**Namespace restrictions.** The packaged source cannot import ``sys``,
``builtins``, ``importlib``, ``inspect``, ``gc``, ``ctypes``, or ``types``,
including submodules such as ``ctypes.util`` and ``importlib.metadata``.
+262 -5
View File
@@ -9,6 +9,7 @@ import base64
import importlib
import hashlib
import json
import os
import subprocess
import sys
import textwrap
@@ -17,6 +18,7 @@ import warnings
from pathlib import Path
from typing import Annotated, Optional, get_type_hints
import numpy as np
import pyarrow as pa
import pytest
@@ -234,10 +236,15 @@ def test_function_can_return_a_list_from_a_generator_expression():
@pytest.mark.parametrize(
("global_value", "value_type"),
[
("pa.struct([('label', pa.string())])", "StructType"),
("(1, (pa.int64(),))", "DataType"),
("{'label': 1}", "dict"),
("float('inf')", "float"),
("{'label': float('nan')}", "float"),
("[1, (2, object())]", "object"),
("{'labels': range(2)}", "range"),
("pa.array([1])", "Int64Array"),
("np.array(['label'])", "ndarray with dtype <U5"),
("np.array([1.0], dtype=np.longdouble)", "ndarray with dtype"),
("np.datetime64('2026-01-01')", "datetime64 with dtype datetime64[D]"),
("np.ma.masked_array([1.0])", "MaskedArray"),
],
)
def test_unsupported_global_names_value_and_remedy(
@@ -254,8 +261,8 @@ def test_unsupported_global_names_value_and_remedy(
module = helper_package(
"fx_unsupported_global",
{
"__init__.py": f"import pyarrow as pa\nCAPTURED_VALUE = {global_value}\n"
+ definition
"__init__.py": "import numpy as np\nimport pyarrow as pa\n"
f"CAPTURED_VALUE = {global_value}\n" + definition
},
)
with pytest.raises(TypeError) as error:
@@ -284,6 +291,256 @@ def test_supported_nested_literal_global_still_packages(helper_package):
assert namespace["CAPTURED_VALUE"] == module.CAPTURED_VALUE
@pytest.mark.parametrize("kind", ["function", "class"])
def test_arrow_and_structured_globals_are_captured(helper_package, kind):
body = (
" if x is None:\n"
" return (LABELS, EMPTY, ARROW, WEIGHTS, NUMPY)\n"
" rows = [{'label': 'pick', 'score': LABELS['pick']}] * len(x)\n"
" return pa.array(rows, type=OUT_TYPE)\n"
)
definition = (
"class judge:\n def __call__(self, x: pa.Array) -> pa.Array:\n"
+ textwrap.indent(body, " ")
if kind == "class"
else "def judge(x: pa.Array) -> pa.Array:\n" + body
)
module = helper_package(
"fx_structured_global",
{
"__init__.py": textwrap.dedent("""
import numpy as np
import pyarrow as pa
OUT_TYPE = pa.struct(
[pa.field("label", pa.string()), pa.field("score", pa.int32())]
)
LABELS = {
"pick": 0,
"place": 1,
"nested": [None, (1.5, b"x"), {"deep": frozenset({"b", "a"})}],
}
EMPTY = ([], {}, set(), frozenset(), ())
ARROW = {
"field": pa.field(
"score", pa.int32(), nullable=False, metadata={"unit": "pts"}
),
"schema": pa.schema(
[pa.field("label", pa.dictionary(pa.int8(), pa.utf8(), True))],
metadata={"version": "1"},
),
"tensor": pa.fixed_shape_tensor(pa.float32(), [2, 2]),
}
WEIGHTS = np.array([[0.1, 0.2], [0.3, 0.4]], dtype=np.float32)
NUMPY = (
np.float32(0.5),
np.True_,
np.uint64(2**64 - 1),
np.array(1.5),
np.zeros((0, 3), dtype=np.int16),
np.array([1.0, -0.0], dtype=">f8"),
)
""")
+ definition
},
)
out_type = module.OUT_TYPE
packaged = function(
input_schema=pa.schema([pa.field("x", pa.int64(), nullable=False)]),
output_schema=pa.field("out", out_type, nullable=False),
)(module.judge)
source = artifact(packaged).decode()
assert "import numpy as _lancedb_numpy" in source
assert "import pyarrow as _lancedb_pyarrow" in source
namespace = {}
exec(compile(source, "user_function.py", "exec"), namespace)
call = namespace["judge"]() if kind == "class" else namespace["judge"]
result = call(pa.array([1, 2]))
assert result.type == out_type
assert result.to_pylist() == [{"label": "pick", "score": 0}] * 2
assert namespace["OUT_TYPE"] == out_type
assert namespace["LABELS"] == module.LABELS
assert list(namespace["LABELS"]) == list(module.LABELS)
assert namespace["EMPTY"] == module.EMPTY
assert [type(value) for value in namespace["EMPTY"]] == [
type(value) for value in module.EMPTY
]
for key, value in module.ARROW.items():
assert namespace["ARROW"][key].equals(value, check_metadata=True)
assert type(namespace["ARROW"][key]) is type(value)
weights = namespace["WEIGHTS"]
assert weights.dtype == module.WEIGHTS.dtype
assert np.array_equal(weights, module.WEIGHTS)
for captured, original in zip(namespace["NUMPY"], module.NUMPY, strict=True):
assert type(captured) is type(original)
assert captured.dtype == original.dtype
assert np.shape(captured) == np.shape(original)
assert np.array_equal(captured, original)
assert np.signbit(namespace["NUMPY"][-1][1])
@pytest.mark.parametrize("kind", ["function", "class"])
@pytest.mark.parametrize("shape", [(0,), (0, 3), (2, 0, 3), (500_000, 0)])
def test_empty_numpy_captures_preserve_shape_without_expanding(
helper_package, kind, shape
):
definition = (
"class empty_size:\n def __call__(self, value: int) -> int:\n"
" return value + EMPTY.size\n"
if kind == "class"
else "def empty_size(value: int) -> int:\n return value + EMPTY.size\n"
)
module = helper_package(
"fx_empty_numpy_global",
{
"__init__.py": "import numpy as np\n"
f"EMPTY = np.empty({shape!r}, dtype='>i2')\n" + definition
},
)
source = artifact(function(module.empty_size))
assert len(source) < 1024
namespace = {}
exec(compile(source, "user_function.py", "exec"), namespace)
captured = namespace["EMPTY"]
assert captured.shape == shape
assert captured.dtype == module.EMPTY.dtype
assert captured.size == 0
call = namespace["empty_size"]() if kind == "class" else namespace["empty_size"]
assert call(7) == 7
def test_captured_containers_are_copied_when_decorated(helper_package):
module = helper_package(
"fx_captured_copy",
{
"__init__.py": """
SHARED = [1, 2]
CONFIG = {"shared": SHARED, "again": SHARED}
def uses_config(value: int) -> int:
return value + len(CONFIG["shared"]) + len(SHARED)
"""
},
)
definition = function(module.uses_config)
module.SHARED.append(3)
namespace = {}
exec(compile(artifact(definition), "user_function.py", "exec"), namespace)
assert namespace["SHARED"] == [1, 2]
assert namespace["CONFIG"] == {"shared": [1, 2], "again": [1, 2]}
assert namespace["CONFIG"]["shared"] is not namespace["CONFIG"]["again"]
assert namespace["CONFIG"]["shared"] is not namespace["SHARED"]
assert namespace["uses_config"](1) == 5
def test_captured_sets_package_deterministically(tmp_path):
script = tmp_path / "sets.py"
script.write_text(
textwrap.dedent(
"""
import json
from lancedb import function
WORDS = {f"word{index}" for index in range(20)}
MIXED = frozenset({("pair", 1), b"bytes", None, 2.5, "text"})
@function
def known(word: str) -> bool:
return word in WORDS or word in MIXED
print(json.dumps([
known.registration_request.artifact.digest,
list(WORDS),
]))
"""
)
)
runs = []
for seed in ("0", "1", "2", "3"):
result = subprocess.run(
[sys.executable, str(script)],
capture_output=True,
text=True,
env={**os.environ, "PYTHONHASHSEED": seed},
)
assert result.returncode == 0, result.stderr
runs.append(json.loads(result.stdout))
# Hash randomization reorders the client's set; the artifact must not change.
assert len({tuple(order) for _, order in runs}) > 1
assert len({digest for digest, _ in runs}) == 1
@pytest.mark.parametrize(
("global_value", "message"),
[
("list(range(300_000))", "too large to capture"),
("np.zeros(2_000_000)", "too large to capture"),
("'x' * (1024 * 1024)", "too large to capture"),
("functools.reduce(lambda inner, _: [inner], range(40), [])", "32 levels"),
("_cycle()", "contains itself"),
("pa.schema([pa.field('x', pa.list_(_Extension()))])", "defined in Python"),
],
)
def test_captured_value_limits_name_the_global(helper_package, global_value, message):
module = helper_package(
"fx_captured_limits",
{
"__init__.py": textwrap.dedent("""
import functools
import numpy as np
import pyarrow as pa
class _Extension(pa.ExtensionType):
def __init__(self):
super().__init__(pa.int64(), "fx.extension")
def __arrow_ext_serialize__(self):
return b""
@classmethod
def __arrow_ext_deserialize__(cls, storage_type, serialized):
return cls()
def _cycle():
value = []
value.append(value)
return value
""")
+ f"CAPTURED_VALUE = {global_value}\n"
"def uses_global(value: int) -> int:\n"
" return value if CAPTURED_VALUE else 0\n"
},
)
with pytest.raises((TypeError, ValueError)) as error:
function(module.uses_global)
assert "CAPTURED_VALUE" in str(error.value)
assert message in str(error.value)
assert "inside the function or class body" in str(error.value)
def test_captured_sets_keep_their_builtins(helper_package):
module = helper_package(
"fx_captured_builtins",
{
"__init__.py": """
STOP = frozenset({"a"})
frozenset = ("shadowed",)
def uses_sets(word: str) -> bool:
return word in STOP or word in frozenset
"""
},
)
with pytest.raises(ValueError, match="cannot package 'frozenset'"):
function(module.uses_sets)
@pytest.mark.parametrize("annotation", ["Array", "RecordBatch"])
@pytest.mark.parametrize("kind", ["function", "class"])
def test_batch_annotations_require_explicit_schemas(annotation, kind, helper_package):
+9 -9
View File
@@ -2147,7 +2147,7 @@ requires-dist = [
{ name = "pyarrow-stubs", marker = "extra == 'tests'", specifier = ">=16.0" },
{ name = "pydantic", specifier = ">=2.7.4,<3" },
{ name = "pylance", marker = "extra == 'pylance'", specifier = ">=15.0.0b3" },
{ name = "pylance", marker = "extra == 'tests'", specifier = "==15.0.0b23" },
{ name = "pylance", marker = "extra == 'tests'", specifier = "==15.0.0b25" },
{ name = "pyright", marker = "extra == 'dev'", specifier = ">=1.1.350" },
{ name = "pytest", marker = "extra == 'tests'", specifier = ">=7.0" },
{ name = "pytest-asyncio", marker = "extra == 'tests'", specifier = ">=0.21" },
@@ -4301,7 +4301,7 @@ crypto = [
[[package]]
name = "pylance"
version = "15.0.0b23"
version = "15.0.0b25"
source = { registry = "https://pypi.fury.io/lance-format/" }
dependencies = [
{ name = "lance-namespace" },
@@ -4312,13 +4312,13 @@ dependencies = [
{ name = "pyarrow", version = "26.0.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
]
wheels = [
{ url = "https://pypi.fury.io/lance-format/-/ver_ldwuz/pylance-15.0.0b23-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:b7980c606424e63e9be645536dbcaff75b479886a53abdae3aef64684c9a6fc4" },
{ url = "https://pypi.fury.io/lance-format/-/ver_5wKzE/pylance-15.0.0b23-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a6d887bc81d5f79b8a23d5cbc840cb56dbea4d8b0a9d2c2edf063dea48bcf741" },
{ url = "https://pypi.fury.io/lance-format/-/ver_FKuk6/pylance-15.0.0b23-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1424bd48cac2160b7745c9b87cd24d81c7cf2b0a89f342ea46ecd2a473ea74e6" },
{ url = "https://pypi.fury.io/lance-format/-/ver_SVglj/pylance-15.0.0b23-cp310-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:09de71b60ac6b8b91fdd73207f71c74bc521626de7e437102ebfe4f2c1f78fa0" },
{ url = "https://pypi.fury.io/lance-format/-/ver_SgTr6/pylance-15.0.0b23-cp310-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:d9385471578bec51ae546f7bd7ea638e20bd12d687082d43ed465017dfd992e7" },
{ url = "https://pypi.fury.io/lance-format/-/ver_wyipY/pylance-15.0.0b23-cp310-abi3-win_amd64.whl", hash = "sha256:7b98b0d78564c5acea3693334c41dc3ced20484fb2c8e738113eeb078281a109" },
{ url = "https://pypi.fury.io/lance-format/-/ver_1v2uEn/pylance-15.0.0b23-cp310-abi3-win_arm64.whl", hash = "sha256:0f4d2645143d44c11237e6ea00772c169a3c6ed23a7c36beaeaef9a18d1be14d" },
{ url = "https://pypi.fury.io/lance-format/-/ver_2hpc2R/pylance-15.0.0b25-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:2a0bb8d6b0c55b7a821989759fc0f8f62cb4da621f89eae232cef49bb7ef341e" },
{ url = "https://pypi.fury.io/lance-format/-/ver_4LUKQ/pylance-15.0.0b25-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9b73e6e9373c4d5af3fea51e63c3e55873f470aa1a6d0412c22916f88ff5df88" },
{ url = "https://pypi.fury.io/lance-format/-/ver_11CcHk/pylance-15.0.0b25-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8090d403b2a38cd4ac8eb09de0327bc404cb3bc965d905f2b6a8479891273fae" },
{ url = "https://pypi.fury.io/lance-format/-/ver_1S87Ih/pylance-15.0.0b25-cp310-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:7f0a20e8ed41d3e49cd5e0bbba97d18ad684cf337e053641321404c9db34f1a1" },
{ url = "https://pypi.fury.io/lance-format/-/ver_13KmLJ/pylance-15.0.0b25-cp310-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:079385a6816a10d42f57bc467d9c822c7207cd31d9a6f768bbf522c0a3007229" },
{ url = "https://pypi.fury.io/lance-format/-/ver_1bTDlQ/pylance-15.0.0b25-cp310-abi3-win_amd64.whl", hash = "sha256:d9b1d713b0d03043a3f5596e909405787f85219f54c427b14437367f0ea7acb9" },
{ url = "https://pypi.fury.io/lance-format/-/ver_j7adN/pylance-15.0.0b25-cp310-abi3-win_arm64.whl", hash = "sha256:4a1c18176ffd6a860c6e66b0deb39fcc9ac1434dba57ee66559b7638ad4a200a" },
]
[[package]]
+4 -2
View File
@@ -1,6 +1,6 @@
[package]
name = "lancedb"
version = "0.42.0-beta.17"
version = "0.42.0-beta.18"
edition.workspace = true
description = "LanceDB: A serverless, low-latency vector database for AI applications"
license.workspace = true
@@ -46,7 +46,7 @@ lance-io = { workspace = true }
lance-index = { workspace = true, features = ["tokenizer-jieba", "tokenizer-lindera"] }
lance-table = { workspace = true }
# Keep the upstream source for downstream SDKs, where workspace patches do not apply.
lance-linalg = { "version" = "=15.0.0-beta.23", "tag" = "v15.0.0-beta.23", "git" = "https://github.com/lance-format/lance.git" }
lance-linalg = { "version" = "=15.0.0-beta.25", "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-encoding = { workspace = true }
lance-arrow = { workspace = true }
lance-namespace = { workspace = true }
@@ -141,6 +141,8 @@ pprof = { version = "0.14", features = ["flamegraph"] }
[features]
default = []
# Shared golden data for downstream compatibility tests.
test-fixtures = []
# Local SQL computed columns and materialized-view creation/refresh.
# Remote clients and shared server primitives do not require this feature.
experimental-functions = []
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "lancedb-cli"
version = "0.42.0-beta.17"
version = "0.42.0-beta.18"
edition = "2021"
license.workspace = true
repository.workspace = true
+86
View File
@@ -1261,6 +1261,46 @@ impl FunctionBinding {
}
}
/// One byte-bounded size tier of a Function refresh plan.
///
/// A row belongs to the first tier whose `max_row_bytes` admits its total
/// descriptor payload size. The final tier has no upper bound and carries the
/// largest configured worker class.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct FunctionRefreshTier {
/// Inclusive upper bound of the rows this tier admits. `None` on the last
/// tier, which also serves rows larger than every configured class.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub max_row_bytes: Option<u64>,
/// Worker resource class selected for this tier.
pub worker_class: String,
/// Worker container memory limit for `worker_class`.
pub worker_memory_bytes: u64,
/// Logical UDF executor budget derived from the worker limit.
pub executor_budget_bytes: u64,
/// Byte target for one materialized Blob input batch on this tier.
pub batch_bytes: u64,
/// Rows assigned to this tier.
pub rows: u64,
/// Byte-bounded batches the assigned rows form at `batch_bytes`.
pub batches: u64,
}
/// Descriptor-derived tier plan for one Function refresh.
///
/// The plan is computed from Blob descriptor sizes before any payload read. It
/// names the same worker classes the refresh supervisor uses for routing.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct FunctionRefreshPlan {
/// Worker class the supervisor starts ordinary work on.
pub default_worker_class: String,
/// Row cap supplied through the `batch_size` override, when present.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub batch_size: Option<u32>,
/// Tiers ordered from the smallest to the largest worker class.
pub tiers: Vec<FunctionRefreshTier>,
}
/// Stable terminal result of an expression-backed or Function-backed column
/// refresh [`crate::Job`].
///
@@ -1279,6 +1319,10 @@ pub struct RefreshColumnResult {
/// Table version made visible by the refresh, when one was published.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub published_version: Option<u64>,
/// Descriptor-derived tier plan, when the refresh is Function-backed and
/// its inputs expose Blob descriptor sizes.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub plan: Option<FunctionRefreshPlan>,
}
/// Which per-row errors [`crate::Table::function_errors`] lists. Every
@@ -1409,6 +1453,48 @@ impl RefreshColumnResult {
impl_json!(RefreshColumnResult);
#[cfg(test)]
mod refresh_result_tests {
use super::{FunctionRefreshPlan, FunctionRefreshTier, RefreshColumnResult};
fn result(plan: Option<FunctionRefreshPlan>) -> RefreshColumnResult {
RefreshColumnResult {
rows_assigned: 3,
rows_failed: 0,
rows_remaining: 0,
source_version: 7,
published_version: Some(8),
plan,
}
}
#[test]
fn absent_plan_stays_out_of_the_terminal_payload() {
let encoded = serde_json::to_value(result(None)).unwrap();
assert!(encoded.get("plan").is_none());
}
#[test]
fn descriptor_plan_round_trips_through_the_terminal_payload() {
let plan = FunctionRefreshPlan {
default_worker_class: "medium".to_string(),
batch_size: Some(1),
tiers: vec![FunctionRefreshTier {
max_row_bytes: None,
worker_class: "large".to_string(),
worker_memory_bytes: 16 << 30,
executor_budget_bytes: 11 << 30,
batch_bytes: 1 << 20,
rows: 3,
batches: 2,
}],
};
let encoded = serde_json::to_value(result(Some(plan.clone()))).unwrap();
let decoded: RefreshColumnResult = serde_json::from_value(encoded).unwrap();
assert_eq!(decoded.plan, Some(plan));
}
}
#[cfg(test)]
mod conda_environment_tests {
use super::{PythonEnvironmentSpec, PythonRuntimeSpec};
+4
View File
@@ -48,6 +48,8 @@
//! Install any `metrics`-compatible recorder to collect them.
//! - `metrics-otel` - Add a pull-based adapter (the `metrics_otel` module) over
//! the `metrics` facade for bridging metrics into OpenTelemetry or similar.
//! - `test-fixtures` - Expose shared golden data through `test_fixtures` for
//! downstream compatibility tests. Disabled by default.
//!
//! ### Quick Start
//!
@@ -220,6 +222,8 @@ pub mod server_info;
pub mod sql;
pub mod storage_integration;
pub mod table;
#[cfg(any(test, feature = "test-fixtures"))]
pub mod test_fixtures;
#[cfg(test)]
pub mod test_utils;
pub mod utils;
+2 -4
View File
@@ -2906,10 +2906,8 @@ mod tests {
#[test]
fn output_arrow_type_grammar_matches_the_shared_golden() {
let golden: serde_json::Value = serde_json::from_str(include_str!(
"../../tests/fixtures/first_class_functions/v1/arrow_types.json"
))
.unwrap();
let golden: serde_json::Value =
serde_json::from_str(crate::test_fixtures::FUNCTION_ARROW_TYPES_JSON).unwrap();
let valid = golden["valid"].as_array().unwrap().iter();
for case in valid.chain(golden["server_only"].as_array().unwrap()) {
let raw = case["arrow_type"].as_str().unwrap();
+5 -1
View File
@@ -653,7 +653,10 @@ async fn execute_refresh_column_with_source(
let session = dataset.session();
let new_dataset = Dataset::commit(
WriteDestination::Dataset(dataset.clone()),
Operation::DataReplacement { replacements },
Operation::DataReplacement {
replacements,
data_change: true,
},
Some(source_version),
None,
None,
@@ -782,6 +785,7 @@ pub(crate) async fn execute_refresh_column_async(
rows_remaining: 0,
source_version: execution.source_version,
published_version: execution.published_version,
plan: None,
})
})))
}
+21
View File
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright The LanceDB Authors
//! Shared golden data for downstream compatibility tests.
//!
//! Enable the `test-fixtures` feature to access these fixtures from another crate.
/// The version 1 Function Arrow type golden as UTF-8 JSON.
///
/// Contains supported declaration spellings, their canonical JSON Arrow types,
/// and declarations that must be rejected. The contents match the golden used by
/// LanceDB's Rust and Python tests; parsing is left to the consumer.
///
/// ```
/// let golden: serde_json::Value =
/// serde_json::from_str(lancedb::test_fixtures::FUNCTION_ARROW_TYPES_JSON).unwrap();
/// assert!(golden["valid"].is_array());
/// assert!(golden["invalid"].is_array());
/// ```
pub const FUNCTION_ARROW_TYPES_JSON: &str =
include_str!("../tests/fixtures/first_class_functions/v1/arrow_types.json");
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "lance-linalg"
version = "15.0.0-beta.23"
version = "15.0.0-beta.25"
publish = false
edition = { workspace = true }
license = { workspace = true }
+2 -2
View File
@@ -1,5 +1,5 @@
This directory contains `rust/lance-linalg` from Lance tag `v15.0.0-beta.23`
(commit `f7ef212132c52f9704c387f342a7ff49a9ebf908`), licensed under Apache-2.0.
This directory contains `rust/lance-linalg` from Lance tag `v15.0.0-beta.25`
(commit `f5dbd55dd79f1f0412f897ed1917128300fb8c1a`), licensed under Apache-2.0.
LanceDB patches `src/distance/cosine.rs` to recompute FLOAT32 cosine distances
in FLOAT64 when squared norms or dot products overflow or underflow. Ordinary