From 15357ab3441a58d3a8431ef804f648735cfb6503 Mon Sep 17 00:00:00 2001 From: Sanket Kedia Date: Sun, 10 Nov 2024 23:04:30 -0800 Subject: [PATCH] Linter --- rust/index/src/spann/types.rs | 14 ++++++++++---- rust/worker/src/segment/spann_segment.rs | 3 +-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/rust/index/src/spann/types.rs b/rust/index/src/spann/types.rs index 2d2592cbf92..e878ba77766 100644 --- a/rust/index/src/spann/types.rs +++ b/rust/index/src/spann/types.rs @@ -20,7 +20,7 @@ use crate::{ }; // TODO(Sanket): Add locking structures as necessary. -struct VersionsMapInner { +pub struct VersionsMapInner { versions_map: HashMap, } @@ -82,8 +82,11 @@ impl ChromaError for SpannIndexWriterConstructionError { const MAX_HEAD_OFFSET_ID: &str = "max_head_offset_id"; // TODO(Sanket): Make this configurable. +#[allow(dead_code)] const NUM_CENTROIDS_TO_SEARCH: u32 = 64; +#[allow(dead_code)] const RNG_FACTOR: f32 = 1.0; +#[allow(dead_code)] const SPLIT_THRESHOLD: usize = 100; impl SpannIndexWriter { @@ -281,6 +284,7 @@ impl SpannIndexWriter { *write_lock.versions_map.get(&id).unwrap() } + #[allow(dead_code)] async fn rng_query( &self, query: &[f32], @@ -341,6 +345,7 @@ impl SpannIndexWriter { Ok((res_ids, res_distances)) } + #[allow(dead_code)] async fn append( &self, head_id: u32, @@ -403,13 +408,14 @@ impl SpannIndexWriter { Ok(()) } + #[allow(dead_code)] async fn add_postings_list( &self, id: u32, version: u32, embeddings: &[f32], ) -> Result<(), SpannIndexWriterConstructionError> { - let (ids, distances) = self.rng_query(embeddings).await?; + let (ids, _) = self.rng_query(embeddings).await?; // Create a centroid with just this point. if ids.is_empty() { let next_id = self @@ -450,7 +456,7 @@ impl SpannIndexWriter { Ok(()) } - pub async fn add(&self, id: u32, embeddings: &[f32]) { - let version = self.add_versions_map(id); + pub async fn add(&self, id: u32, _: &[f32]) { + let _ = self.add_versions_map(id); } } diff --git a/rust/worker/src/segment/spann_segment.rs b/rust/worker/src/segment/spann_segment.rs index b9ac0479b9c..ae70f1a5e76 100644 --- a/rust/worker/src/segment/spann_segment.rs +++ b/rust/worker/src/segment/spann_segment.rs @@ -1,6 +1,5 @@ use std::collections::HashMap; -use arrow::{compute::max, error}; use chroma_blockstore::provider::BlockfileProvider; use chroma_error::{ChromaError, ErrorCodes}; use chroma_index::IndexUuid; @@ -197,7 +196,7 @@ impl<'a> SegmentWriter<'a> for SpannSegmentWriter { &self, records: chroma_types::Chunk>, ) -> Result<(), ApplyMaterializedLogError> { - for (record, idx) in records.iter() { + for (record, _) in records.iter() { match record.final_operation { MaterializedLogOperation::AddNew => { self.add(record).await;