Skip to content

Commit

Permalink
chore: remove unused code (#2494)
Browse files Browse the repository at this point in the history
Signed-off-by: BubbleCal <[email protected]>
  • Loading branch information
BubbleCal authored Jun 21, 2024
1 parent 0608cfd commit ec04990
Showing 1 changed file with 2 additions and 34 deletions.
36 changes: 2 additions & 34 deletions rust/lance-index/src/vector/pq/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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},
Expand Down Expand Up @@ -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<dyn Iterator<Item = ProductQuantizationStorage>>,
) -> 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::<ManifestDescribing>::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.
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit ec04990

Please sign in to comment.