From a6bdffd75b7f0ee31f09b7c00b9a1e19780136d5 Mon Sep 17 00:00:00 2001 From: Rob Meng Date: Thu, 29 Jun 2023 18:50:02 -0400 Subject: [PATCH] bump lance to 0.5.2, make object store construction hook public (#237) * bump to 0.5.2 to pick up S3 auth fixes * make `open_table_params` a public attribute * add `open_table_with_params` on `Database` --- Cargo.lock | 14 ++------------ rust/ffi/node/Cargo.toml | 2 +- rust/vectordb/Cargo.toml | 2 +- rust/vectordb/src/database.rs | 22 ++++++++++++++++++++-- rust/vectordb/src/table.rs | 6 +++--- 5 files changed, 27 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9b54a718..acd9d4d6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1636,9 +1636,9 @@ dependencies = [ [[package]] name = "lance" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76dad119202267ad3f2a5f5dd4b38a9ce7f66c13c14005c2588f9a18da7f25ab" +checksum = "c9394675e5f03bedf00952fec1ff4d1525a1a4ceff36ae41018bc354e9ff771a" dependencies = [ "arrow", "arrow-arith", @@ -1678,7 +1678,6 @@ dependencies = [ "roaring", "shellexpand", "snafu", - "sqlparser-lance", "tokio", "url", "uuid", @@ -2912,15 +2911,6 @@ dependencies = [ "sqlparser_derive", ] -[[package]] -name = "sqlparser-lance" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d6869d4a81a3594c324d22a21767b8cf91961d30f8f219201f9e10951a16a17" -dependencies = [ - "log", -] - [[package]] name = "sqlparser_derive" version = "0.1.1" diff --git a/rust/ffi/node/Cargo.toml b/rust/ffi/node/Cargo.toml index da6cdba5..9700fc49 100644 --- a/rust/ffi/node/Cargo.toml +++ b/rust/ffi/node/Cargo.toml @@ -15,7 +15,7 @@ arrow-ipc = "40.0" arrow-schema = "40.0" once_cell = "1" futures = "0.3" -lance = "0.5.1" +lance = "0.5.2" vectordb = { path = "../../vectordb" } tokio = { version = "1.23", features = ["rt-multi-thread"] } neon = {version = "0.10.1", default-features = false, features = ["channel-api", "napi-6", "promise-api", "task-api"] } diff --git a/rust/vectordb/Cargo.toml b/rust/vectordb/Cargo.toml index 51d6680d..bd79f5ce 100644 --- a/rust/vectordb/Cargo.toml +++ b/rust/vectordb/Cargo.toml @@ -14,7 +14,7 @@ arrow-data = "40.0" arrow-schema = "40.0" object_store = "0.6.1" snafu = "0.7.4" -lance = "0.5.1" +lance = "0.5.2" tokio = { version = "1.23", features = ["rt-multi-thread"] } [dev-dependencies] diff --git a/rust/vectordb/src/database.rs b/rust/vectordb/src/database.rs index c058e59d..90713ed0 100644 --- a/rust/vectordb/src/database.rs +++ b/rust/vectordb/src/database.rs @@ -20,7 +20,7 @@ use lance::io::object_store::ObjectStore; use snafu::prelude::*; use crate::error::{CreateDirSnafu, Result}; -use crate::table::Table; +use crate::table::{OpenTableParams, Table}; pub struct Database { object_store: ObjectStore, @@ -107,7 +107,25 @@ impl Database { /// /// * A [Table] object. pub async fn open_table(&self, name: &str) -> Result { - Table::open(&self.uri, name).await + self.open_table_with_params(name, OpenTableParams::default()) + .await + } + + /// Open a table in the database. + /// + /// # Arguments + /// * `name` - The name of the table. + /// * `params` - The parameters to open the table. + /// + /// # Returns + /// + /// * A [Table] object. + pub async fn open_table_with_params( + &self, + name: &str, + params: OpenTableParams, + ) -> Result
{ + Table::open_with_params(&self.uri, name, params).await } /// Drop a table in the database. diff --git a/rust/vectordb/src/table.rs b/rust/vectordb/src/table.rs index d441f230..bc8e9f83 100644 --- a/rust/vectordb/src/table.rs +++ b/rust/vectordb/src/table.rs @@ -43,7 +43,7 @@ impl std::fmt::Display for Table { #[derive(Default)] pub struct OpenTableParams { - pub(crate) dataset_read_params: ReadParams, + pub open_table_params: ReadParams, } impl Table { @@ -85,7 +85,7 @@ impl Table { .to_str() .context(InvalidTableNameSnafu { name })?; - let dataset = Dataset::open_with_params(uri, ¶ms.dataset_read_params) + let dataset = Dataset::open_with_params(uri, ¶ms.open_table_params) .await .map_err(|e| match e { lance::Error::DatasetNotFound { .. } => Error::TableNotFound { @@ -394,7 +394,7 @@ mod tests { let wrapper = Arc::new(NoOpCacheWrapper::default()); let param = OpenTableParams { - dataset_read_params: ReadParams { + open_table_params: ReadParams { store_options: Some(ObjectStoreParams { object_store_wrapper: Some(wrapper.clone()), }),