Compare commits

...

2 Commits

Author SHA1 Message Date
Jack Ye 85098c7435 feat: use declare_table instead of deprecated create_empty_table
Replace create_empty_table calls with declare_table in the namespace
module. create_empty_table is deprecated and being removed in Lance 3.0.0.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-20 22:24:21 -08:00
lancedb automation 08b8be2ea6 chore: update lance dependency to v3.0.0-beta.4 2026-02-20 23:22:55 +00:00
10 changed files with 96 additions and 125 deletions
Generated
+57 -60
View File
@@ -1389,9 +1389,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]] [[package]]
name = "bytes" name = "bytes"
version = "1.10.1" version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33"
[[package]] [[package]]
name = "bytes-utils" name = "bytes-utils"
@@ -1783,6 +1783,16 @@ dependencies = [
"crossbeam-utils", "crossbeam-utils",
] ]
[[package]]
name = "crossbeam-skiplist"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df29de440c58ca2cc6e587ec3d22347551a32435fbde9d2bff64e78a9ffa151b"
dependencies = [
"crossbeam-epoch",
"crossbeam-utils",
]
[[package]] [[package]]
name = "crossbeam-utils" name = "crossbeam-utils"
version = "0.8.21" version = "0.8.21"
@@ -3072,9 +3082,8 @@ checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c"
[[package]] [[package]]
name = "fsst" name = "fsst"
version = "2.0.1" version = "3.0.0-beta.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/lance-format/lance.git?tag=v3.0.0-beta.4#649b4871dbcbc4f26586e33677b1f9535d9a7f63"
checksum = "5f9e5c0b1c67a38cb92b41535d44623483beb9511592ae23a3bf42ddec758690"
dependencies = [ dependencies = [
"arrow-array", "arrow-array",
"rand 0.9.2", "rand 0.9.2",
@@ -4405,9 +4414,8 @@ dependencies = [
[[package]] [[package]]
name = "lance" name = "lance"
version = "2.0.1" version = "3.0.0-beta.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/lance-format/lance.git?tag=v3.0.0-beta.4#649b4871dbcbc4f26586e33677b1f9535d9a7f63"
checksum = "2b7f07b905df393a5554eba19055c620f9ea25a3e40a013bda4bd8dc4ca66f01"
dependencies = [ dependencies = [
"arrow", "arrow",
"arrow-arith", "arrow-arith",
@@ -4426,6 +4434,7 @@ dependencies = [
"byteorder", "byteorder",
"bytes", "bytes",
"chrono", "chrono",
"crossbeam-skiplist",
"dashmap", "dashmap",
"datafusion", "datafusion",
"datafusion-expr", "datafusion-expr",
@@ -4465,6 +4474,7 @@ dependencies = [
"tantivy", "tantivy",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
"tokio-util",
"tracing", "tracing",
"url", "url",
"uuid", "uuid",
@@ -4472,9 +4482,8 @@ dependencies = [
[[package]] [[package]]
name = "lance-arrow" name = "lance-arrow"
version = "2.0.1" version = "3.0.0-beta.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/lance-format/lance.git?tag=v3.0.0-beta.4#649b4871dbcbc4f26586e33677b1f9535d9a7f63"
checksum = "100e076cb81c8f0c24cd2881c706fc53e037c7d6e81eb320e929e265d157effb"
dependencies = [ dependencies = [
"arrow-array", "arrow-array",
"arrow-buffer", "arrow-buffer",
@@ -4493,9 +4502,8 @@ dependencies = [
[[package]] [[package]]
name = "lance-bitpacking" name = "lance-bitpacking"
version = "2.0.1" version = "3.0.0-beta.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/lance-format/lance.git?tag=v3.0.0-beta.4#649b4871dbcbc4f26586e33677b1f9535d9a7f63"
checksum = "588318d3d1ba0f97162fab39a323a0a49866bb35b32af42572c6b6a12296fa27"
dependencies = [ dependencies = [
"arrayref", "arrayref",
"paste", "paste",
@@ -4504,9 +4512,8 @@ dependencies = [
[[package]] [[package]]
name = "lance-core" name = "lance-core"
version = "2.0.1" version = "3.0.0-beta.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/lance-format/lance.git?tag=v3.0.0-beta.4#649b4871dbcbc4f26586e33677b1f9535d9a7f63"
checksum = "6fa01d1cf490ccfd3b8eaeee2781415d0419e6be8366040e57e43677abf2644e"
dependencies = [ dependencies = [
"arrow-array", "arrow-array",
"arrow-buffer", "arrow-buffer",
@@ -4543,9 +4550,8 @@ dependencies = [
[[package]] [[package]]
name = "lance-datafusion" name = "lance-datafusion"
version = "2.0.1" version = "3.0.0-beta.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/lance-format/lance.git?tag=v3.0.0-beta.4#649b4871dbcbc4f26586e33677b1f9535d9a7f63"
checksum = "ef89a39e3284eef76f79e63f23de8881a0583ad6feb20ed39f47eadd847a2b88"
dependencies = [ dependencies = [
"arrow", "arrow",
"arrow-array", "arrow-array",
@@ -4568,6 +4574,7 @@ dependencies = [
"log", "log",
"pin-project", "pin-project",
"prost", "prost",
"prost-build",
"snafu", "snafu",
"tokio", "tokio",
"tracing", "tracing",
@@ -4575,9 +4582,8 @@ dependencies = [
[[package]] [[package]]
name = "lance-datagen" name = "lance-datagen"
version = "2.0.1" version = "3.0.0-beta.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/lance-format/lance.git?tag=v3.0.0-beta.4#649b4871dbcbc4f26586e33677b1f9535d9a7f63"
checksum = "fc2a60eef5c47e65d91e2ffa8e7e1629c52e7190c8b88a371a1a60601dc49371"
dependencies = [ dependencies = [
"arrow", "arrow",
"arrow-array", "arrow-array",
@@ -4595,9 +4601,8 @@ dependencies = [
[[package]] [[package]]
name = "lance-encoding" name = "lance-encoding"
version = "2.0.1" version = "3.0.0-beta.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/lance-format/lance.git?tag=v3.0.0-beta.4#649b4871dbcbc4f26586e33677b1f9535d9a7f63"
checksum = "95ce4a6631308aa681b2671af8f2a845ff781f8d4e755a2a7ccd012379467094"
dependencies = [ dependencies = [
"arrow-arith", "arrow-arith",
"arrow-array", "arrow-array",
@@ -4634,9 +4639,8 @@ dependencies = [
[[package]] [[package]]
name = "lance-file" name = "lance-file"
version = "2.0.1" version = "3.0.0-beta.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/lance-format/lance.git?tag=v3.0.0-beta.4#649b4871dbcbc4f26586e33677b1f9535d9a7f63"
checksum = "e2d4d82357cbfaa1a18494226c15b1cb3c8ed0b6c84b91146323c82047ede419"
dependencies = [ dependencies = [
"arrow-arith", "arrow-arith",
"arrow-array", "arrow-array",
@@ -4668,9 +4672,8 @@ dependencies = [
[[package]] [[package]]
name = "lance-geo" name = "lance-geo"
version = "2.0.1" version = "3.0.0-beta.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/lance-format/lance.git?tag=v3.0.0-beta.4#649b4871dbcbc4f26586e33677b1f9535d9a7f63"
checksum = "a7183fc870da62826f0f97df8007b634da053eb310157856efe1dc74f446951c"
dependencies = [ dependencies = [
"datafusion", "datafusion",
"geo-traits", "geo-traits",
@@ -4684,9 +4687,8 @@ dependencies = [
[[package]] [[package]]
name = "lance-index" name = "lance-index"
version = "2.0.1" version = "3.0.0-beta.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/lance-format/lance.git?tag=v3.0.0-beta.4#649b4871dbcbc4f26586e33677b1f9535d9a7f63"
checksum = "20e9c5aa7024a63af9ae89ee8c0f23c8421b7896742e5cd4a271a60f9956cb80"
dependencies = [ dependencies = [
"arrow", "arrow",
"arrow-arith", "arrow-arith",
@@ -4753,9 +4755,8 @@ dependencies = [
[[package]] [[package]]
name = "lance-io" name = "lance-io"
version = "2.0.1" version = "3.0.0-beta.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/lance-format/lance.git?tag=v3.0.0-beta.4#649b4871dbcbc4f26586e33677b1f9535d9a7f63"
checksum = "c7d2af0b17fb374a8181bcf1a10bce5703ae3ee4373c1587ce4bba23e15e45c8"
dependencies = [ dependencies = [
"arrow", "arrow",
"arrow-arith", "arrow-arith",
@@ -4788,6 +4789,7 @@ dependencies = [
"serde", "serde",
"shellexpand", "shellexpand",
"snafu", "snafu",
"tempfile",
"tokio", "tokio",
"tracing", "tracing",
"url", "url",
@@ -4795,9 +4797,8 @@ dependencies = [
[[package]] [[package]]
name = "lance-linalg" name = "lance-linalg"
version = "2.0.1" version = "3.0.0-beta.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/lance-format/lance.git?tag=v3.0.0-beta.4#649b4871dbcbc4f26586e33677b1f9535d9a7f63"
checksum = "5125aa62696e75a7475807564b4921f252d8815be606b84bc00e6def0f5c24bb"
dependencies = [ dependencies = [
"arrow-array", "arrow-array",
"arrow-buffer", "arrow-buffer",
@@ -4813,9 +4814,8 @@ dependencies = [
[[package]] [[package]]
name = "lance-namespace" name = "lance-namespace"
version = "2.0.1" version = "3.0.0-beta.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/lance-format/lance.git?tag=v3.0.0-beta.4#649b4871dbcbc4f26586e33677b1f9535d9a7f63"
checksum = "70545c2676ce954dfd801da5c6a631a70bba967826cd3a8f31b47d1f04bbfed3"
dependencies = [ dependencies = [
"arrow", "arrow",
"async-trait", "async-trait",
@@ -4827,9 +4827,8 @@ dependencies = [
[[package]] [[package]]
name = "lance-namespace-impls" name = "lance-namespace-impls"
version = "2.0.1" version = "3.0.0-beta.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/lance-format/lance.git?tag=v3.0.0-beta.4#649b4871dbcbc4f26586e33677b1f9535d9a7f63"
checksum = "92519f9f27d62655030aac62ea0db9614b65f086ebe651c1b0a96e351b668022"
dependencies = [ dependencies = [
"arrow", "arrow",
"arrow-ipc", "arrow-ipc",
@@ -4844,6 +4843,7 @@ dependencies = [
"lance-index", "lance-index",
"lance-io", "lance-io",
"lance-namespace", "lance-namespace",
"lance-table",
"log", "log",
"object_store", "object_store",
"rand 0.9.2", "rand 0.9.2",
@@ -4859,9 +4859,9 @@ dependencies = [
[[package]] [[package]]
name = "lance-namespace-reqwest-client" name = "lance-namespace-reqwest-client"
version = "0.4.5" version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2acdba67f84190067532fce07b51a435dd390d7cdc1129a05003e5cb3274cf0" checksum = "3ad4c947349acd6e37e984eba0254588bd894e6128434338b9e6904e56fb4633"
dependencies = [ dependencies = [
"reqwest", "reqwest",
"serde", "serde",
@@ -4872,9 +4872,8 @@ dependencies = [
[[package]] [[package]]
name = "lance-table" name = "lance-table"
version = "2.0.1" version = "3.0.0-beta.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/lance-format/lance.git?tag=v3.0.0-beta.4#649b4871dbcbc4f26586e33677b1f9535d9a7f63"
checksum = "b06ad37bd90045de8ef533df170c6098e6ff6ecb427aade47d7db8e2c86f2678"
dependencies = [ dependencies = [
"arrow", "arrow",
"arrow-array", "arrow-array",
@@ -4913,9 +4912,8 @@ dependencies = [
[[package]] [[package]]
name = "lance-testing" name = "lance-testing"
version = "2.0.1" version = "3.0.0-beta.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/lance-format/lance.git?tag=v3.0.0-beta.4#649b4871dbcbc4f26586e33677b1f9535d9a7f63"
checksum = "cd7f13b0f2b6337af015dcb1519645388dca08c970037aa77aff517687c4019f"
dependencies = [ dependencies = [
"arrow-array", "arrow-array",
"arrow-schema", "arrow-schema",
@@ -5628,11 +5626,10 @@ dependencies = [
[[package]] [[package]]
name = "num-bigint-dig" name = "num-bigint-dig"
version = "0.8.4" version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" checksum = "e661dda6640fad38e827a6d4a310ff4763082116fe217f279885c97f511bb0b7"
dependencies = [ dependencies = [
"byteorder",
"lazy_static", "lazy_static",
"libm", "libm",
"num-integer", "num-integer",
@@ -7274,9 +7271,9 @@ dependencies = [
[[package]] [[package]]
name = "roaring" name = "roaring"
version = "0.10.12" version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19e8d2cfa184d94d0726d650a9f4a1be7f9b76ac9fdb954219878dc00c1c1e7b" checksum = "8ba9ce64a8f45d7fc86358410bb1a82e8c987504c0d4900e9141d69a9f26c885"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"byteorder", "byteorder",
+14 -14
View File
@@ -15,20 +15,20 @@ categories = ["database-implementations"]
rust-version = "1.88.0" rust-version = "1.88.0"
[workspace.dependencies] [workspace.dependencies]
lance = { "version" = "=2.0.1", default-features = false } lance = { "version" = "=3.0.0-beta.4", default-features = false, "tag" = "v3.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
lance-core = "=2.0.1" lance-core = { "version" = "=3.0.0-beta.4", "tag" = "v3.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
lance-datagen = "=2.0.1" lance-datagen = { "version" = "=3.0.0-beta.4", "tag" = "v3.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
lance-file = "=2.0.1" lance-file = { "version" = "=3.0.0-beta.4", "tag" = "v3.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
lance-io = { "version" = "=2.0.1", default-features = false } lance-io = { "version" = "=3.0.0-beta.4", default-features = false, "tag" = "v3.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
lance-index = "=2.0.1" lance-index = { "version" = "=3.0.0-beta.4", "tag" = "v3.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
lance-linalg = "=2.0.1" lance-linalg = { "version" = "=3.0.0-beta.4", "tag" = "v3.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
lance-namespace = "=2.0.1" lance-namespace = { "version" = "=3.0.0-beta.4", "tag" = "v3.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
lance-namespace-impls = { "version" = "=2.0.1", default-features = false } lance-namespace-impls = { "version" = "=3.0.0-beta.4", default-features = false, "tag" = "v3.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
lance-table = "=2.0.1" lance-table = { "version" = "=3.0.0-beta.4", "tag" = "v3.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
lance-testing = "=2.0.1" lance-testing = { "version" = "=3.0.0-beta.4", "tag" = "v3.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
lance-datafusion = "=2.0.1" lance-datafusion = { "version" = "=3.0.0-beta.4", "tag" = "v3.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
lance-encoding = "=2.0.1" lance-encoding = { "version" = "=3.0.0-beta.4", "tag" = "v3.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
lance-arrow = "=2.0.1" lance-arrow = { "version" = "=3.0.0-beta.4", "tag" = "v3.0.0-beta.4", "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 }
+1 -1
View File
@@ -28,7 +28,7 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<arrow.version>15.0.0</arrow.version> <arrow.version>15.0.0</arrow.version>
<lance-core.version>2.0.1</lance-core.version> <lance-core.version>3.0.0-beta.4</lance-core.version>
<spotless.skip>false</spotless.skip> <spotless.skip>false</spotless.skip>
<spotless.version>2.30.0</spotless.version> <spotless.version>2.30.0</spotless.version>
<spotless.java.googlejavaformat.version>1.7</spotless.java.googlejavaformat.version> <spotless.java.googlejavaformat.version>1.7</spotless.java.googlejavaformat.version>
+13 -13
View File
@@ -44,7 +44,7 @@ from lance_namespace import (
ListNamespacesRequest, ListNamespacesRequest,
CreateNamespaceRequest, CreateNamespaceRequest,
DropNamespaceRequest, DropNamespaceRequest,
CreateEmptyTableRequest, DeclareTableRequest,
) )
from lancedb.table import AsyncTable, LanceTable, Table from lancedb.table import AsyncTable, LanceTable, Table
from lancedb.util import validate_table_name from lancedb.util import validate_table_name
@@ -318,20 +318,20 @@ class LanceNamespaceDBConnection(DBConnection):
if location is None: if location is None:
# Table doesn't exist or mode is "create", reserve a new location # Table doesn't exist or mode is "create", reserve a new location
create_empty_request = CreateEmptyTableRequest( declare_request = DeclareTableRequest(
id=table_id, id=table_id,
location=None, location=None,
properties=self.storage_options if self.storage_options else None, properties=self.storage_options if self.storage_options else None,
) )
create_empty_response = self._ns.create_empty_table(create_empty_request) declare_response = self._ns.declare_table(declare_request)
if not create_empty_response.location: if not declare_response.location:
raise ValueError( raise ValueError(
"Table location is missing from create_empty_table response" "Table location is missing from declare_table response"
) )
location = create_empty_response.location location = declare_response.location
namespace_storage_options = create_empty_response.storage_options namespace_storage_options = declare_response.storage_options
# Merge storage options: self.storage_options < user options < namespace options # Merge storage options: self.storage_options < user options < namespace options
merged_storage_options = dict(self.storage_options) merged_storage_options = dict(self.storage_options)
@@ -759,20 +759,20 @@ class AsyncLanceNamespaceDBConnection:
if location is None: if location is None:
# Table doesn't exist or mode is "create", reserve a new location # Table doesn't exist or mode is "create", reserve a new location
create_empty_request = CreateEmptyTableRequest( declare_request = DeclareTableRequest(
id=table_id, id=table_id,
location=None, location=None,
properties=self.storage_options if self.storage_options else None, properties=self.storage_options if self.storage_options else None,
) )
create_empty_response = self._ns.create_empty_table(create_empty_request) declare_response = self._ns.declare_table(declare_request)
if not create_empty_response.location: if not declare_response.location:
raise ValueError( raise ValueError(
"Table location is missing from create_empty_table response" "Table location is missing from declare_table response"
) )
location = create_empty_response.location location = declare_response.location
namespace_storage_options = create_empty_response.storage_options namespace_storage_options = declare_response.storage_options
# Merge storage options: self.storage_options < user options < namespace options # Merge storage options: self.storage_options < user options < namespace options
merged_storage_options = dict(self.storage_options) merged_storage_options = dict(self.storage_options)
+1 -1
View File
@@ -1,2 +1,2 @@
[toolchain] [toolchain]
channel = "1.90.0" channel = "1.91.0"
+2 -6
View File
@@ -85,8 +85,10 @@ pub type TableBuilderCallback = Box<dyn FnOnce(OpenTableRequest) -> OpenTableReq
/// Describes what happens when creating a table and a table with /// Describes what happens when creating a table and a table with
/// the same name already exists /// the same name already exists
#[derive(Default)]
pub enum CreateTableMode { pub enum CreateTableMode {
/// If the table already exists, an error is returned /// If the table already exists, an error is returned
#[default]
Create, Create,
/// If the table already exists, it is opened. Any provided data is /// If the table already exists, it is opened. Any provided data is
/// ignored. The function will be passed an OpenTableBuilder to customize /// ignored. The function will be passed an OpenTableBuilder to customize
@@ -104,12 +106,6 @@ impl CreateTableMode {
} }
} }
impl Default for CreateTableMode {
fn default() -> Self {
Self::Create
}
}
/// A request to create a table /// A request to create a table
pub struct CreateTableRequest { pub struct CreateTableRequest {
/// The name of the new table /// The name of the new table
@@ -57,7 +57,7 @@ pub struct PermutationConfig {
} }
/// Strategy for shuffling the data. /// Strategy for shuffling the data.
#[derive(Debug, Clone)] #[derive(Debug, Clone, Default)]
pub enum ShuffleStrategy { pub enum ShuffleStrategy {
/// The data is randomly shuffled /// The data is randomly shuffled
/// ///
@@ -78,15 +78,10 @@ pub enum ShuffleStrategy {
/// The data is not shuffled /// The data is not shuffled
/// ///
/// This is useful for debugging and testing. /// This is useful for debugging and testing.
#[default]
None, None,
} }
impl Default for ShuffleStrategy {
fn default() -> Self {
Self::None
}
}
/// Builder for creating a permutation table. /// Builder for creating a permutation table.
/// ///
/// A permutation table is a table that stores split assignments and a shuffled order of rows. This /// A permutation table is a table that stores split assignments and a shuffled order of rows. This
@@ -27,9 +27,10 @@ use crate::{
pub const SPLIT_ID_COLUMN: &str = "split_id"; pub const SPLIT_ID_COLUMN: &str = "split_id";
/// Strategy for assigning rows to splits /// Strategy for assigning rows to splits
#[derive(Debug, Clone)] #[derive(Debug, Clone, Default)]
pub enum SplitStrategy { pub enum SplitStrategy {
/// All rows will have split id 0 /// All rows will have split id 0
#[default]
NoSplit, NoSplit,
/// Rows will be randomly assigned to splits /// Rows will be randomly assigned to splits
/// ///
@@ -73,15 +74,6 @@ pub enum SplitStrategy {
Calculated { calculation: String }, Calculated { calculation: String },
} }
// The default is not to split the data
//
// All data will be assigned to a single split.
impl Default for SplitStrategy {
fn default() -> Self {
Self::NoSplit
}
}
impl SplitStrategy { impl SplitStrategy {
pub fn validate(&self, num_rows: u64) -> Result<()> { pub fn validate(&self, num_rows: u64) -> Result<()> {
match self { match self {
+2 -7
View File
@@ -192,13 +192,14 @@ pub use error::{Error, Result};
use lance_linalg::distance::DistanceType as LanceDistanceType; use lance_linalg::distance::DistanceType as LanceDistanceType;
pub use table::Table; pub use table::Table;
#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)] #[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize, Default)]
#[non_exhaustive] #[non_exhaustive]
#[serde(rename_all = "lowercase")] #[serde(rename_all = "lowercase")]
pub enum DistanceType { pub enum DistanceType {
/// Euclidean distance. This is a very common distance metric that /// Euclidean distance. This is a very common distance metric that
/// accounts for both magnitude and direction when determining the distance /// accounts for both magnitude and direction when determining the distance
/// between vectors. l2 distance has a range of [0, ∞). /// between vectors. l2 distance has a range of [0, ∞).
#[default]
L2, L2,
/// Cosine distance. Cosine distance is a distance metric /// Cosine distance. Cosine distance is a distance metric
/// calculated from the cosine similarity between two vectors. Cosine /// calculated from the cosine similarity between two vectors. Cosine
@@ -220,12 +221,6 @@ pub enum DistanceType {
Hamming, Hamming,
} }
impl Default for DistanceType {
fn default() -> Self {
Self::L2
}
}
impl From<DistanceType> for LanceDistanceType { impl From<DistanceType> for LanceDistanceType {
fn from(value: DistanceType) -> Self { fn from(value: DistanceType) -> Self {
match value { match value {
+2 -6
View File
@@ -26,8 +26,10 @@ use crate::error::Result;
/// optimize different parts of the table on disk. /// optimize different parts of the table on disk.
/// ///
/// By default, it optimizes everything, as [`OptimizeAction::All`]. /// By default, it optimizes everything, as [`OptimizeAction::All`].
#[derive(Default)]
pub enum OptimizeAction { pub enum OptimizeAction {
/// Run all optimizations with default values /// Run all optimizations with default values
#[default]
All, All,
/// Compacts files in the dataset /// Compacts files in the dataset
/// ///
@@ -84,12 +86,6 @@ pub enum OptimizeAction {
Index(OptimizeOptions), Index(OptimizeOptions),
} }
impl Default for OptimizeAction {
fn default() -> Self {
Self::All
}
}
/// Statistics about the optimization. /// Statistics about the optimization.
#[derive(Debug, Default)] #[derive(Debug, Default)]
pub struct OptimizeStats { pub struct OptimizeStats {