Skip to content

Commit

Permalink
[ENH]: Rust frontend proptest
Browse files Browse the repository at this point in the history
  • Loading branch information
codetheweb committed Mar 7, 2025
1 parent db72c7c commit 59e8d53
Show file tree
Hide file tree
Showing 19 changed files with 1,679 additions and 151 deletions.
35 changes: 25 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ rust-embed = { version = "8.5.0", features = ["include-exclude", "debug-embed"]
hnswlib = { version = "0.8.0", git = "https://github.com/chroma-core/hnswlib.git" }
reqwest = { version = "0.12.9" }
random-port = "0.1.1"
ndarray = { version = "0.16.1", features = ["approx"] }

chroma-benchmark = { path = "rust/benchmark" }
chroma-blockstore = { path = "rust/blockstore" }
Expand All @@ -81,8 +82,8 @@ worker = { path = "rust/worker" }
# Dev dependencies
bincode = "1.3.3"
indicatif = "0.17.9"
proptest = "1.5.0"
proptest-state-machine = "0.3.0"
proptest = "1.6.0"
proptest-state-machine = "0.3.1"
proptest-derive = "0.5.1"
rand = "0.8.5"
rand_xorshift = "0.3.0"
Expand Down
6 changes: 6 additions & 0 deletions rust/frontend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,9 @@ utoipa-swagger-ui = { version = "9", features = ["axum"] }
[dev-dependencies]
reqwest = { workspace = true }
random-port = { workspace = true }
proptest = { workspace = true }
proptest-state-machine = { workspace = true }
chroma-types = { workspace = true, features = ["testing"] }
tempfile = { workspace = true }
worker = { workspace = true }
ndarray = { workspace = true }
13 changes: 12 additions & 1 deletion rust/frontend/src/executor/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,18 @@ impl LocalExecutor {
.await?;
if let Some(dimensionality) = collection_and_segments.collection.dimension {
let allowed_user_ids = if plan.filter.where_clause.is_none() {
plan.filter.query_ids.unwrap_or_default()
match plan.filter.query_ids {
Some(ids) => {
if ids.is_empty() {
return Ok(vec![Default::default(); plan.knn.embeddings.len()]);
}

ids
}
None => {
vec![]
}
}
} else {
let filter_plan = Get {
scan: plan.scan.clone(),
Expand Down
2 changes: 1 addition & 1 deletion rust/frontend/src/impls/in_memory_frontend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ impl InMemoryFrontend {
}

pub fn count(
&mut self,
&self,
request: chroma_types::CountRequest,
) -> Result<chroma_types::CountResponse, chroma_types::QueryError> {
let collection = self
Expand Down
Loading

0 comments on commit 59e8d53

Please sign in to comment.