mirror of
https://github.com/lancedb/lancedb.git
synced 2026-08-30 01:48:19 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2974b7e5c6 |
Generated
+696
-577
File diff suppressed because it is too large
Load Diff
+31
-31
@@ -13,40 +13,40 @@ categories = ["database-implementations"]
|
|||||||
rust-version = "1.91.0"
|
rust-version = "1.91.0"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
lance = { "version" = "=6.0.0-beta.4", default-features = false, "tag" = "v6.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
|
lance = { "version" = "=6.0.0-beta.6", default-features = false, "tag" = "v6.0.0-beta.6", "git" = "https://github.com/lance-format/lance.git" }
|
||||||
lance-core = { "version" = "=6.0.0-beta.4", "tag" = "v6.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
|
lance-core = { "version" = "=6.0.0-beta.6", "tag" = "v6.0.0-beta.6", "git" = "https://github.com/lance-format/lance.git" }
|
||||||
lance-datagen = { "version" = "=6.0.0-beta.4", "tag" = "v6.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
|
lance-datagen = { "version" = "=6.0.0-beta.6", "tag" = "v6.0.0-beta.6", "git" = "https://github.com/lance-format/lance.git" }
|
||||||
lance-file = { "version" = "=6.0.0-beta.4", "tag" = "v6.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
|
lance-file = { "version" = "=6.0.0-beta.6", "tag" = "v6.0.0-beta.6", "git" = "https://github.com/lance-format/lance.git" }
|
||||||
lance-io = { "version" = "=6.0.0-beta.4", default-features = false, "tag" = "v6.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
|
lance-io = { "version" = "=6.0.0-beta.6", default-features = false, "tag" = "v6.0.0-beta.6", "git" = "https://github.com/lance-format/lance.git" }
|
||||||
lance-index = { "version" = "=6.0.0-beta.4", "tag" = "v6.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
|
lance-index = { "version" = "=6.0.0-beta.6", "tag" = "v6.0.0-beta.6", "git" = "https://github.com/lance-format/lance.git" }
|
||||||
lance-linalg = { "version" = "=6.0.0-beta.4", "tag" = "v6.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
|
lance-linalg = { "version" = "=6.0.0-beta.6", "tag" = "v6.0.0-beta.6", "git" = "https://github.com/lance-format/lance.git" }
|
||||||
lance-namespace = { "version" = "=6.0.0-beta.4", "tag" = "v6.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
|
lance-namespace = { "version" = "=6.0.0-beta.6", "tag" = "v6.0.0-beta.6", "git" = "https://github.com/lance-format/lance.git" }
|
||||||
lance-namespace-impls = { "version" = "=6.0.0-beta.4", default-features = false, "tag" = "v6.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
|
lance-namespace-impls = { "version" = "=6.0.0-beta.6", default-features = false, "tag" = "v6.0.0-beta.6", "git" = "https://github.com/lance-format/lance.git" }
|
||||||
lance-table = { "version" = "=6.0.0-beta.4", "tag" = "v6.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
|
lance-table = { "version" = "=6.0.0-beta.6", "tag" = "v6.0.0-beta.6", "git" = "https://github.com/lance-format/lance.git" }
|
||||||
lance-testing = { "version" = "=6.0.0-beta.4", "tag" = "v6.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
|
lance-testing = { "version" = "=6.0.0-beta.6", "tag" = "v6.0.0-beta.6", "git" = "https://github.com/lance-format/lance.git" }
|
||||||
lance-datafusion = { "version" = "=6.0.0-beta.4", "tag" = "v6.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
|
lance-datafusion = { "version" = "=6.0.0-beta.6", "tag" = "v6.0.0-beta.6", "git" = "https://github.com/lance-format/lance.git" }
|
||||||
lance-encoding = { "version" = "=6.0.0-beta.4", "tag" = "v6.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
|
lance-encoding = { "version" = "=6.0.0-beta.6", "tag" = "v6.0.0-beta.6", "git" = "https://github.com/lance-format/lance.git" }
|
||||||
lance-arrow = { "version" = "=6.0.0-beta.4", "tag" = "v6.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
|
lance-arrow = { "version" = "=6.0.0-beta.6", "tag" = "v6.0.0-beta.6", "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 = "58.1", optional = false }
|
||||||
arrow-array = "57.2"
|
arrow-array = "58.1"
|
||||||
arrow-data = "57.2"
|
arrow-data = "58.1"
|
||||||
arrow-ipc = "57.2"
|
arrow-ipc = "58.1"
|
||||||
arrow-ord = "57.2"
|
arrow-ord = "58.1"
|
||||||
arrow-schema = "57.2"
|
arrow-schema = "58.1"
|
||||||
arrow-select = "57.2"
|
arrow-select = "58.1"
|
||||||
arrow-cast = "57.2"
|
arrow-cast = "58.1"
|
||||||
async-trait = "0"
|
async-trait = "0"
|
||||||
datafusion = { version = "52.1", default-features = false }
|
datafusion = { version = "53.1", default-features = false }
|
||||||
datafusion-catalog = "52.1"
|
datafusion-catalog = "53.1"
|
||||||
datafusion-common = { version = "52.1", default-features = false }
|
datafusion-common = { version = "53.1", default-features = false }
|
||||||
datafusion-execution = "52.1"
|
datafusion-execution = "53.1"
|
||||||
datafusion-expr = "52.1"
|
datafusion-expr = "53.1"
|
||||||
datafusion-functions = "52.1"
|
datafusion-functions = "53.1"
|
||||||
datafusion-physical-plan = "52.1"
|
datafusion-physical-plan = "53.1"
|
||||||
datafusion-physical-expr = "52.1"
|
datafusion-physical-expr = "53.1"
|
||||||
datafusion-sql = "52.1"
|
datafusion-sql = "53.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",
|
||||||
|
|||||||
+1
-1
@@ -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>6.0.0-beta.4</lance-core.version>
|
<lance-core.version>6.0.0-beta.6</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>
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ crate-type = ["cdylib"]
|
|||||||
async-trait.workspace = true
|
async-trait.workspace = true
|
||||||
arrow-ipc.workspace = true
|
arrow-ipc.workspace = true
|
||||||
arrow-array.workspace = true
|
arrow-array.workspace = true
|
||||||
arrow-buffer = "57.2"
|
arrow-buffer = "58.1"
|
||||||
half.workspace = true
|
half.workspace = true
|
||||||
arrow-schema.workspace = true
|
arrow-schema.workspace = true
|
||||||
env_logger.workspace = true
|
env_logger.workspace = true
|
||||||
|
|||||||
+4
-4
@@ -15,7 +15,7 @@ name = "_lancedb"
|
|||||||
crate-type = ["cdylib"]
|
crate-type = ["cdylib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
arrow = { version = "57.2", features = ["pyarrow"] }
|
arrow = { workspace = true, features = ["pyarrow"] }
|
||||||
async-trait = "0.1"
|
async-trait = "0.1"
|
||||||
bytes = "1"
|
bytes = "1"
|
||||||
lancedb = { path = "../rust/lancedb", default-features = false }
|
lancedb = { path = "../rust/lancedb", default-features = false }
|
||||||
@@ -25,8 +25,8 @@ lance-namespace-impls.workspace = true
|
|||||||
lance-io.workspace = true
|
lance-io.workspace = true
|
||||||
env_logger.workspace = true
|
env_logger.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
pyo3 = { version = "0.26", features = ["extension-module", "abi3-py39"] }
|
pyo3 = { version = "0.28", features = ["extension-module", "abi3-py39"] }
|
||||||
pyo3-async-runtimes = { version = "0.26", features = [
|
pyo3-async-runtimes = { version = "0.28", features = [
|
||||||
"attributes",
|
"attributes",
|
||||||
"tokio-runtime",
|
"tokio-runtime",
|
||||||
] }
|
] }
|
||||||
@@ -38,7 +38,7 @@ snafu.workspace = true
|
|||||||
tokio = { version = "1.40", features = ["sync"] }
|
tokio = { version = "1.40", features = ["sync"] }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
pyo3-build-config = { version = "0.26", features = [
|
pyo3-build-config = { version = "0.28", features = [
|
||||||
"extension-module",
|
"extension-module",
|
||||||
"abi3-py39",
|
"abi3-py39",
|
||||||
] }
|
] }
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ use pyo3::{Bound, PyAny, PyResult, exceptions::PyValueError, prelude::*, pyfunct
|
|||||||
/// [`expr_lit`] and combined with the methods on this struct. On the Python
|
/// [`expr_lit`] and combined with the methods on this struct. On the Python
|
||||||
/// side a thin wrapper class (`lancedb.expr.Expr`) delegates to these methods
|
/// side a thin wrapper class (`lancedb.expr.Expr`) delegates to these methods
|
||||||
/// and adds Python operator overloads.
|
/// and adds Python operator overloads.
|
||||||
#[pyclass(name = "PyExpr")]
|
#[pyclass(name = "PyExpr", from_py_object)]
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct PyExpr(pub DfExpr);
|
pub struct PyExpr(pub DfExpr);
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ impl PyHeaderProvider {
|
|||||||
Ok(headers_py) => {
|
Ok(headers_py) => {
|
||||||
// Convert Python dict to Rust HashMap
|
// Convert Python dict to Rust HashMap
|
||||||
let bound_headers = headers_py.bind(py);
|
let bound_headers = headers_py.bind(py);
|
||||||
let dict: &Bound<PyDict> = bound_headers.downcast().map_err(|e| {
|
let dict: &Bound<PyDict> = bound_headers.cast().map_err(|e| {
|
||||||
format!("HeaderProvider.get_headers must return a dict: {}", e)
|
format!("HeaderProvider.get_headers must return a dict: {}", e)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@ pub fn class_name(ob: &'_ Bound<'_, PyAny>) -> PyResult<String> {
|
|||||||
let full_name = ob
|
let full_name = ob
|
||||||
.getattr(intern!(ob.py(), "__class__"))?
|
.getattr(intern!(ob.py(), "__class__"))?
|
||||||
.getattr(intern!(ob.py(), "__name__"))?;
|
.getattr(intern!(ob.py(), "__name__"))?;
|
||||||
let full_name = full_name.downcast()?.to_string_lossy();
|
let full_name = full_name.cast()?.to_string_lossy();
|
||||||
|
|
||||||
match full_name.rsplit_once('.') {
|
match full_name.rsplit_once('.') {
|
||||||
Some((_, name)) => Ok(name.to_string()),
|
Some((_, name)) => Ok(name.to_string()),
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ async fn call_py_method_primitive<Req, Resp>(
|
|||||||
) -> lance_core::Result<Resp>
|
) -> lance_core::Result<Resp>
|
||||||
where
|
where
|
||||||
Req: serde::Serialize + Send + 'static,
|
Req: serde::Serialize + Send + 'static,
|
||||||
Resp: for<'py> pyo3::FromPyObject<'py> + Send + 'static,
|
Resp: for<'a, 'py> pyo3::FromPyObject<'a, 'py> + Send + 'static,
|
||||||
{
|
{
|
||||||
let request_json = serde_json::to_string(&request).map_err(|e| {
|
let request_json = serde_json::to_string(&request).map_err(|e| {
|
||||||
lance_core::Error::io(format!(
|
lance_core::Error::io(format!(
|
||||||
@@ -203,7 +203,7 @@ where
|
|||||||
|
|
||||||
// Call the Python method
|
// Call the Python method
|
||||||
let result = py_namespace.call_method1(py, method_name, (request_arg,))?;
|
let result = py_namespace.call_method1(py, method_name, (request_arg,))?;
|
||||||
let value: Resp = result.extract(py)?;
|
let value: Resp = result.extract(py).map_err(Into::into)?;
|
||||||
Ok::<_, PyErr>(value)
|
Ok::<_, PyErr>(value)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -25,12 +25,12 @@ use pyo3_async_runtimes::tokio::future_into_py;
|
|||||||
|
|
||||||
fn table_from_py<'a>(table: Bound<'a, PyAny>) -> PyResult<Bound<'a, Table>> {
|
fn table_from_py<'a>(table: Bound<'a, PyAny>) -> PyResult<Bound<'a, Table>> {
|
||||||
if table.hasattr("_inner")? {
|
if table.hasattr("_inner")? {
|
||||||
Ok(table.getattr("_inner")?.downcast_into::<Table>()?)
|
Ok(table.getattr("_inner")?.cast_into::<Table>()?)
|
||||||
} else if table.hasattr("_table")? {
|
} else if table.hasattr("_table")? {
|
||||||
Ok(table
|
Ok(table
|
||||||
.getattr("_table")?
|
.getattr("_table")?
|
||||||
.getattr("_inner")?
|
.getattr("_inner")?
|
||||||
.downcast_into::<Table>()?)
|
.cast_into::<Table>()?)
|
||||||
} else {
|
} else {
|
||||||
Err(PyRuntimeError::new_err(
|
Err(PyRuntimeError::new_err(
|
||||||
"Provided table does not appear to be a Table or RemoteTable instance",
|
"Provided table does not appear to be a Table or RemoteTable instance",
|
||||||
@@ -90,9 +90,9 @@ impl PyAsyncPermutationBuilder {
|
|||||||
database
|
database
|
||||||
.getattr("_conn")?
|
.getattr("_conn")?
|
||||||
.getattr("_inner")?
|
.getattr("_inner")?
|
||||||
.downcast_into::<Connection>()?
|
.cast_into::<Connection>()?
|
||||||
} else {
|
} else {
|
||||||
database.getattr("_inner")?.downcast_into::<Connection>()?
|
database.getattr("_inner")?.cast_into::<Connection>()?
|
||||||
};
|
};
|
||||||
let database = conn.borrow().database()?;
|
let database = conn.borrow().database()?;
|
||||||
slf.modify(|builder| builder.persist(database, table_name))
|
slf.modify(|builder| builder.persist(database, table_name))
|
||||||
@@ -243,7 +243,7 @@ impl PyPermutationReader {
|
|||||||
let Some(selection) = selection else {
|
let Some(selection) = selection else {
|
||||||
return Ok(Select::All);
|
return Ok(Select::All);
|
||||||
};
|
};
|
||||||
let selection = selection.downcast_into::<PyDict>()?;
|
let selection = selection.cast_into::<PyDict>()?;
|
||||||
let selection = selection
|
let selection = selection
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(key, value)| {
|
.map(|(key, value)| {
|
||||||
|
|||||||
+9
-6
@@ -22,6 +22,7 @@ use lancedb::query::{
|
|||||||
VectorQuery as LanceDbVectorQuery,
|
VectorQuery as LanceDbVectorQuery,
|
||||||
};
|
};
|
||||||
use lancedb::table::AnyQuery;
|
use lancedb::table::AnyQuery;
|
||||||
|
use pyo3::Borrowed;
|
||||||
use pyo3::Bound;
|
use pyo3::Bound;
|
||||||
use pyo3::IntoPyObject;
|
use pyo3::IntoPyObject;
|
||||||
use pyo3::PyAny;
|
use pyo3::PyAny;
|
||||||
@@ -43,9 +44,11 @@ use crate::util::parse_distance_type;
|
|||||||
use crate::{arrow::RecordBatchStream, util::PyLanceDB};
|
use crate::{arrow::RecordBatchStream, util::PyLanceDB};
|
||||||
use crate::{error::PythonErrorExt, index::class_name};
|
use crate::{error::PythonErrorExt, index::class_name};
|
||||||
|
|
||||||
impl FromPyObject<'_> for PyLanceDB<FtsQuery> {
|
impl FromPyObject<'_, '_> for PyLanceDB<FtsQuery> {
|
||||||
fn extract_bound(ob: &Bound<'_, PyAny>) -> PyResult<Self> {
|
type Error = PyErr;
|
||||||
match class_name(ob)?.as_str() {
|
|
||||||
|
fn extract(ob: Borrowed<'_, '_, PyAny>) -> PyResult<Self> {
|
||||||
|
match class_name(&ob)?.as_str() {
|
||||||
"MatchQuery" => {
|
"MatchQuery" => {
|
||||||
let query = ob.getattr("query")?.extract()?;
|
let query = ob.getattr("query")?.extract()?;
|
||||||
let column = ob.getattr("column")?.extract()?;
|
let column = ob.getattr("column")?.extract()?;
|
||||||
@@ -424,7 +427,7 @@ impl Query {
|
|||||||
"Query text is required for nearest_to_text",
|
"Query text is required for nearest_to_text",
|
||||||
))?;
|
))?;
|
||||||
|
|
||||||
let query = if let Ok(query_text) = fts_query.downcast::<PyString>() {
|
let query = if let Ok(query_text) = fts_query.cast::<PyString>() {
|
||||||
let mut query_text = query_text.to_string();
|
let mut query_text = query_text.to_string();
|
||||||
let columns = query
|
let columns = query
|
||||||
.get_item("columns")?
|
.get_item("columns")?
|
||||||
@@ -606,7 +609,7 @@ impl TakeQuery {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass]
|
#[pyclass(from_py_object)]
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct FTSQuery {
|
pub struct FTSQuery {
|
||||||
inner: LanceDbQuery,
|
inner: LanceDbQuery,
|
||||||
@@ -735,7 +738,7 @@ impl FTSQuery {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass]
|
#[pyclass(from_py_object)]
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct VectorQuery {
|
pub struct VectorQuery {
|
||||||
inner: LanceDbVectorQuery,
|
inner: LanceDbVectorQuery,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ use pyo3::{PyResult, pyclass, pymethods};
|
|||||||
/// Sessions allow you to configure cache sizes for index and metadata caches,
|
/// Sessions allow you to configure cache sizes for index and metadata caches,
|
||||||
/// which can significantly impact memory use and performance. They can
|
/// which can significantly impact memory use and performance. They can
|
||||||
/// also be re-used across multiple connections to share the same cache state.
|
/// also be re-used across multiple connections to share the same cache state.
|
||||||
#[pyclass]
|
#[pyclass(from_py_object)]
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Session {
|
pub struct Session {
|
||||||
pub(crate) inner: Arc<LanceSession>,
|
pub(crate) inner: Arc<LanceSession>,
|
||||||
|
|||||||
+10
-10
@@ -29,7 +29,7 @@ use pyo3_async_runtimes::tokio::future_into_py;
|
|||||||
mod scannable;
|
mod scannable;
|
||||||
|
|
||||||
/// Statistics about a compaction operation.
|
/// Statistics about a compaction operation.
|
||||||
#[pyclass(get_all)]
|
#[pyclass(get_all, from_py_object)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct CompactionStats {
|
pub struct CompactionStats {
|
||||||
/// The number of fragments removed
|
/// The number of fragments removed
|
||||||
@@ -43,7 +43,7 @@ pub struct CompactionStats {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Statistics about a cleanup operation
|
/// Statistics about a cleanup operation
|
||||||
#[pyclass(get_all)]
|
#[pyclass(get_all, from_py_object)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct RemovalStats {
|
pub struct RemovalStats {
|
||||||
/// The number of bytes removed
|
/// The number of bytes removed
|
||||||
@@ -53,7 +53,7 @@ pub struct RemovalStats {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Statistics about an optimize operation
|
/// Statistics about an optimize operation
|
||||||
#[pyclass(get_all)]
|
#[pyclass(get_all, from_py_object)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct OptimizeStats {
|
pub struct OptimizeStats {
|
||||||
/// Statistics about the compaction operation
|
/// Statistics about the compaction operation
|
||||||
@@ -62,7 +62,7 @@ pub struct OptimizeStats {
|
|||||||
pub prune: RemovalStats,
|
pub prune: RemovalStats,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(get_all)]
|
#[pyclass(get_all, from_py_object)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct UpdateResult {
|
pub struct UpdateResult {
|
||||||
pub rows_updated: u64,
|
pub rows_updated: u64,
|
||||||
@@ -88,7 +88,7 @@ impl From<lancedb::table::UpdateResult> for UpdateResult {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(get_all)]
|
#[pyclass(get_all, from_py_object)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct AddResult {
|
pub struct AddResult {
|
||||||
pub version: u64,
|
pub version: u64,
|
||||||
@@ -109,7 +109,7 @@ impl From<lancedb::table::AddResult> for AddResult {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(get_all)]
|
#[pyclass(get_all, from_py_object)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct DeleteResult {
|
pub struct DeleteResult {
|
||||||
pub num_deleted_rows: u64,
|
pub num_deleted_rows: u64,
|
||||||
@@ -135,7 +135,7 @@ impl From<lancedb::table::DeleteResult> for DeleteResult {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(get_all)]
|
#[pyclass(get_all, from_py_object)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct MergeResult {
|
pub struct MergeResult {
|
||||||
pub version: u64,
|
pub version: u64,
|
||||||
@@ -171,7 +171,7 @@ impl From<lancedb::table::MergeResult> for MergeResult {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(get_all)]
|
#[pyclass(get_all, from_py_object)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct AddColumnsResult {
|
pub struct AddColumnsResult {
|
||||||
pub version: u64,
|
pub version: u64,
|
||||||
@@ -192,7 +192,7 @@ impl From<lancedb::table::AddColumnsResult> for AddColumnsResult {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(get_all)]
|
#[pyclass(get_all, from_py_object)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct AlterColumnsResult {
|
pub struct AlterColumnsResult {
|
||||||
pub version: u64,
|
pub version: u64,
|
||||||
@@ -213,7 +213,7 @@ impl From<lancedb::table::AlterColumnsResult> for AlterColumnsResult {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(get_all)]
|
#[pyclass(get_all, from_py_object)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct DropColumnsResult {
|
pub struct DropColumnsResult {
|
||||||
pub version: u64,
|
pub version: u64,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ use lancedb::{
|
|||||||
arrow::{SendableRecordBatchStream, SimpleRecordBatchStream},
|
arrow::{SendableRecordBatchStream, SimpleRecordBatchStream},
|
||||||
data::scannable::Scannable,
|
data::scannable::Scannable,
|
||||||
};
|
};
|
||||||
use pyo3::{FromPyObject, Py, PyAny, Python, types::PyAnyMethods};
|
use pyo3::{Borrowed, FromPyObject, Py, PyAny, Python, types::PyAnyMethods};
|
||||||
|
|
||||||
/// Adapter that implements Scannable for a Python reader factory callable.
|
/// Adapter that implements Scannable for a Python reader factory callable.
|
||||||
///
|
///
|
||||||
@@ -126,8 +126,10 @@ impl Scannable for PyScannable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'py> FromPyObject<'py> for PyScannable {
|
impl FromPyObject<'_, '_> for PyScannable {
|
||||||
fn extract_bound(ob: &pyo3::Bound<'py, PyAny>) -> pyo3::PyResult<Self> {
|
type Error = pyo3::PyErr;
|
||||||
|
|
||||||
|
fn extract(ob: Borrowed<'_, '_, PyAny>) -> pyo3::PyResult<Self> {
|
||||||
// Convert from Scannable dataclass.
|
// Convert from Scannable dataclass.
|
||||||
let schema: PyArrowType<Schema> = ob.getattr("schema")?.extract()?;
|
let schema: PyArrowType<Schema> = ob.getattr("schema")?.extract()?;
|
||||||
let schema = Arc::new(schema.0);
|
let schema = Arc::new(schema.0);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ pub struct RemoteInsertExec<S: HttpSend = Sender> {
|
|||||||
client: RestfulLanceDbClient<S>,
|
client: RestfulLanceDbClient<S>,
|
||||||
input: Arc<dyn ExecutionPlan>,
|
input: Arc<dyn ExecutionPlan>,
|
||||||
overwrite: bool,
|
overwrite: bool,
|
||||||
properties: PlanProperties,
|
properties: Arc<PlanProperties>,
|
||||||
add_result: Arc<Mutex<Option<AddResult>>>,
|
add_result: Arc<Mutex<Option<AddResult>>>,
|
||||||
metrics: ExecutionPlanMetricsSet,
|
metrics: ExecutionPlanMetricsSet,
|
||||||
upload_id: Option<String>,
|
upload_id: Option<String>,
|
||||||
@@ -105,12 +105,12 @@ impl<S: HttpSend + 'static> RemoteInsertExec<S> {
|
|||||||
1
|
1
|
||||||
};
|
};
|
||||||
let schema = COUNT_SCHEMA.clone();
|
let schema = COUNT_SCHEMA.clone();
|
||||||
let properties = PlanProperties::new(
|
let properties = Arc::new(PlanProperties::new(
|
||||||
EquivalenceProperties::new(schema),
|
EquivalenceProperties::new(schema),
|
||||||
datafusion_physical_plan::Partitioning::UnknownPartitioning(num_partitions),
|
datafusion_physical_plan::Partitioning::UnknownPartitioning(num_partitions),
|
||||||
datafusion_physical_plan::execution_plan::EmissionType::Final,
|
datafusion_physical_plan::execution_plan::EmissionType::Final,
|
||||||
datafusion_physical_plan::execution_plan::Boundedness::Bounded,
|
datafusion_physical_plan::execution_plan::Boundedness::Bounded,
|
||||||
);
|
));
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
table_name,
|
table_name,
|
||||||
@@ -232,7 +232,7 @@ impl<S: HttpSend + 'static> ExecutionPlan for RemoteInsertExec<S> {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn properties(&self) -> &PlanProperties {
|
fn properties(&self) -> &Arc<PlanProperties> {
|
||||||
&self.properties
|
&self.properties
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,21 +39,26 @@ use lance_index::scalar::FullTextSearchQuery;
|
|||||||
struct MetadataEraserExec {
|
struct MetadataEraserExec {
|
||||||
input: Arc<dyn ExecutionPlan>,
|
input: Arc<dyn ExecutionPlan>,
|
||||||
schema: Arc<ArrowSchema>,
|
schema: Arc<ArrowSchema>,
|
||||||
properties: PlanProperties,
|
properties: Arc<PlanProperties>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MetadataEraserExec {
|
impl MetadataEraserExec {
|
||||||
fn compute_properties_from_input(
|
fn compute_properties_from_input(
|
||||||
input: &Arc<dyn ExecutionPlan>,
|
input: &Arc<dyn ExecutionPlan>,
|
||||||
schema: &Arc<ArrowSchema>,
|
schema: &Arc<ArrowSchema>,
|
||||||
) -> PlanProperties {
|
) -> Arc<PlanProperties> {
|
||||||
let input_properties = input.properties();
|
let input_properties = input.properties();
|
||||||
let eq_properties = input_properties
|
let eq_properties = input_properties
|
||||||
.eq_properties
|
.eq_properties
|
||||||
.clone()
|
.clone()
|
||||||
.with_new_schema(schema.clone())
|
.with_new_schema(schema.clone())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
input_properties.clone().with_eq_properties(eq_properties)
|
Arc::new(
|
||||||
|
input_properties
|
||||||
|
.as_ref()
|
||||||
|
.clone()
|
||||||
|
.with_eq_properties(eq_properties),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new(input: Arc<dyn ExecutionPlan>) -> Self {
|
fn new(input: Arc<dyn ExecutionPlan>) -> Self {
|
||||||
@@ -87,7 +92,7 @@ impl ExecutionPlan for MetadataEraserExec {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn properties(&self) -> &PlanProperties {
|
fn properties(&self) -> &Arc<PlanProperties> {
|
||||||
&self.properties
|
&self.properties
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ pub struct InsertExec {
|
|||||||
dataset: Arc<Dataset>,
|
dataset: Arc<Dataset>,
|
||||||
input: Arc<dyn ExecutionPlan>,
|
input: Arc<dyn ExecutionPlan>,
|
||||||
write_params: WriteParams,
|
write_params: WriteParams,
|
||||||
properties: PlanProperties,
|
properties: Arc<PlanProperties>,
|
||||||
partial_transactions: Arc<Mutex<Vec<Transaction>>>,
|
partial_transactions: Arc<Mutex<Vec<Transaction>>>,
|
||||||
metrics: ExecutionPlanMetricsSet,
|
metrics: ExecutionPlanMetricsSet,
|
||||||
}
|
}
|
||||||
@@ -95,12 +95,12 @@ impl InsertExec {
|
|||||||
) -> Self {
|
) -> Self {
|
||||||
let schema = COUNT_SCHEMA.clone();
|
let schema = COUNT_SCHEMA.clone();
|
||||||
let num_partitions = input.output_partitioning().partition_count();
|
let num_partitions = input.output_partitioning().partition_count();
|
||||||
let properties = PlanProperties::new(
|
let properties = Arc::new(PlanProperties::new(
|
||||||
EquivalenceProperties::new(schema),
|
EquivalenceProperties::new(schema),
|
||||||
Partitioning::UnknownPartitioning(num_partitions),
|
Partitioning::UnknownPartitioning(num_partitions),
|
||||||
EmissionType::Final,
|
EmissionType::Final,
|
||||||
Boundedness::Bounded,
|
Boundedness::Bounded,
|
||||||
);
|
));
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
ds_wrapper,
|
ds_wrapper,
|
||||||
@@ -136,7 +136,7 @@ impl ExecutionPlan for InsertExec {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn properties(&self) -> &PlanProperties {
|
fn properties(&self) -> &Arc<PlanProperties> {
|
||||||
&self.properties
|
&self.properties
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ pub(crate) struct ScannableExec {
|
|||||||
// We don't require Scannable to be Sync, so we wrap it in a Mutex to allow safe concurrent access.
|
// We don't require Scannable to be Sync, so we wrap it in a Mutex to allow safe concurrent access.
|
||||||
source: Mutex<Box<dyn Scannable>>,
|
source: Mutex<Box<dyn Scannable>>,
|
||||||
num_rows: Option<usize>,
|
num_rows: Option<usize>,
|
||||||
properties: PlanProperties,
|
properties: Arc<PlanProperties>,
|
||||||
tracker: Option<Arc<WriteProgressTracker>>,
|
tracker: Option<Arc<WriteProgressTracker>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,12 +37,12 @@ impl ScannableExec {
|
|||||||
pub fn new(source: Box<dyn Scannable>, tracker: Option<Arc<WriteProgressTracker>>) -> Self {
|
pub fn new(source: Box<dyn Scannable>, tracker: Option<Arc<WriteProgressTracker>>) -> Self {
|
||||||
let schema = source.schema();
|
let schema = source.schema();
|
||||||
let eq_properties = EquivalenceProperties::new(schema);
|
let eq_properties = EquivalenceProperties::new(schema);
|
||||||
let properties = PlanProperties::new(
|
let properties = Arc::new(PlanProperties::new(
|
||||||
eq_properties,
|
eq_properties,
|
||||||
Partitioning::UnknownPartitioning(1),
|
Partitioning::UnknownPartitioning(1),
|
||||||
EmissionType::Incremental,
|
EmissionType::Incremental,
|
||||||
datafusion_physical_plan::execution_plan::Boundedness::Bounded,
|
datafusion_physical_plan::execution_plan::Boundedness::Bounded,
|
||||||
);
|
));
|
||||||
|
|
||||||
let num_rows = source.num_rows();
|
let num_rows = source.num_rows();
|
||||||
let source = Mutex::new(source);
|
let source = Mutex::new(source);
|
||||||
@@ -70,7 +70,7 @@ impl ExecutionPlan for ScannableExec {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn properties(&self) -> &PlanProperties {
|
fn properties(&self) -> &Arc<PlanProperties> {
|
||||||
&self.properties
|
&self.properties
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user