Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: BubbleCal <bubble-cal@outlook.com>
  • Loading branch information
BubbleCal committed Mar 11, 2025
1 parent 8f96ffd commit b5e4359
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
3 changes: 2 additions & 1 deletion rust/lance-index/src/vector/ivf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use super::quantizer::Quantization;
use super::residual::ResidualTransform;
use super::sq::transform::SQTransformer;
use super::sq::ScalarQuantizer;
use super::transform::KeepFiniteVectors;
use super::transform::{DropColumn, KeepFiniteVectors};

Check warning on line 28 in rust/lance-index/src/vector/ivf.rs

View workflow job for this annotation

GitHub Actions / linux-build (stable)

unused import: `DropColumn`

Check warning on line 28 in rust/lance-index/src/vector/ivf.rs

View workflow job for this annotation

GitHub Actions / linux-arm

unused import: `DropColumn`

Check warning on line 28 in rust/lance-index/src/vector/ivf.rs

View workflow job for this annotation

GitHub Actions / linux-arm

unused import: `DropColumn`

Check warning on line 28 in rust/lance-index/src/vector/ivf.rs

View workflow job for this annotation

GitHub Actions / linux-build (nightly)

unused import: `DropColumn`

Check warning on line 28 in rust/lance-index/src/vector/ivf.rs

View workflow job for this annotation

GitHub Actions / linux-build (nightly)

unused import: `DropColumn`
use super::{quantizer::Quantizer, residual::compute_residual};
use super::{PART_ID_COLUMN, PQ_CODE_COLUMN, SQ_CODE_COLUMN};

Expand Down Expand Up @@ -200,6 +200,7 @@ impl IvfTransformer {
vector_column,
PQ_CODE_COLUMN,
)));

Self::new(centroids, distance_type, transforms)
}

Expand Down
1 change: 1 addition & 0 deletions rust/lance-index/src/vector/v3/shuffler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ impl Shuffler for IvfShuffler {
.column_by_name(PART_ID_COLUMN)
.expect("Partition ID column not found")
.as_primitive();
let batch = batch.drop_column(PART_ID_COLUMN)?;

let mut partition_buffers =
(0..num_partitions).map(|_| Vec::new()).collect::<Vec<_>>();
Expand Down
14 changes: 13 additions & 1 deletion rust/lance/src/index/vector/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,18 @@ impl<S: IvfSubIndex + 'static, Q: Quantization + 'static> IvfIndexBuilder<S, Q>
if num_rows == 0 {
return Ok((0, 0));
}
for batch in batches.iter() {
if batch.schema() != batches[0].schema() {
return Err(Error::invalid_input(
format!(
"batch schema mismatch: expected {:?}, got {:?}",
batches[0].schema(),
batch.schema()
),
location!(),
));
}
}
let batch = arrow::compute::concat_batches(&batches[0].schema(), batches.iter())?;

Self::build_partition(
Expand Down Expand Up @@ -602,7 +614,7 @@ impl<S: IvfSubIndex + 'static, Q: Quantization + 'static> IvfIndexBuilder<S, Q>
// Ok(batch.try_with_column(PART_ID_FIELD.clone(), Arc::new(part_ids))?)
// })
// .collect::<Result<Vec<_>>>()?;
batches.extend(part_batches);
batches.extend(part_batches.map(|b| b.with_metadata(HashMap::new()).unwrap()));
}

if reader.partition_size(part_id)? > 0 {
Expand Down

0 comments on commit b5e4359

Please # to comment.