From ec04990a63ace6b49ab600da2447a549a69092cf Mon Sep 17 00:00:00 2001 From: BubbleCal Date: Fri, 21 Jun 2024 11:54:10 +0800 Subject: [PATCH] chore: remove unused code (#2494) Signed-off-by: BubbleCal --- rust/lance-index/src/vector/pq/storage.rs | 36 ++--------------------- 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/rust/lance-index/src/vector/pq/storage.rs b/rust/lance-index/src/vector/pq/storage.rs index fe92b22b53..87b0fcd19e 100644 --- a/rust/lance-index/src/vector/pq/storage.rs +++ b/rust/lance-index/src/vector/pq/storage.rs @@ -17,7 +17,7 @@ use arrow_schema::SchemaRef; use async_trait::async_trait; use deepsize::DeepSizeOf; use lance_arrow::FixedSizeListArrayExt; -use lance_core::{datatypes::Schema, Error, Result, ROW_ID}; +use lance_core::{Error, Result, ROW_ID}; use lance_file::{reader::FileReader, writer::FileWriter}; use lance_io::{ object_store::ObjectStore, @@ -35,7 +35,6 @@ use super::{distance::build_distance_table_l2, num_centroids, ProductQuantizerIm use crate::{ pb, vector::{ - ivf::storage::IvfData, pq::transform::PQTransformer, quantizer::{QuantizerMetadata, QuantizerStorage}, storage::{DistCalculator, VectorStore}, @@ -96,38 +95,6 @@ impl QuantizerMetadata for ProductQuantizationMetadata { } } -/// Write partition of PQ storage to disk. -#[allow(dead_code)] -pub async fn write_parted_product_quantizations( - object_store: &ObjectStore, - path: &Path, - partitions: Box>, -) -> Result<()> { - let mut peek = partitions.peekable(); - let first = peek.peek().ok_or(Error::Index { - message: "No partitions to write".to_string(), - location: location!(), - })?; - let schema = first.schema(); - let lance_schema = Schema::try_from(schema.as_ref())?; - let mut writer = FileWriter::::try_new( - object_store, - path, - lance_schema, - &Default::default(), // TODO: support writer options. - ) - .await?; - - let mut ivf_data = IvfData::empty(); - for storage in peek { - let num_rows = storage.write_partition(&mut writer).await?; - ivf_data.add_partition(num_rows as u32); - } - ivf_data.write(&mut writer).await?; - - Ok(()) -} - /// Product Quantization Storage /// /// It stores PQ code, as well as the row ID to the orignal vectors. @@ -602,6 +569,7 @@ mod tests { use arrow_schema::{DataType, Field, Schema as ArrowSchema}; use lance_arrow::FixedSizeListArrayExt; + use lance_core::datatypes::Schema; use lance_core::ROW_ID_FIELD; const DIM: usize = 32;