From 564b727f1e4e3ae6403c6ffab00d7984474c8427 Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Fri, 12 Sep 2025 15:31:54 +0200 Subject: [PATCH] avoid the divide-by-zero situation by doing what's done on tip --- rust/lance/src/index/vector/builder.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rust/lance/src/index/vector/builder.rs b/rust/lance/src/index/vector/builder.rs index 1f812f2c1a9..681e37f8f7a 100644 --- a/rust/lance/src/index/vector/builder.rs +++ b/rust/lance/src/index/vector/builder.rs @@ -656,6 +656,10 @@ impl IvfIndexBuilder // for PQ, the PQ codes are transposed, so we need to transpose them back if matches!(Q::quantization_type(), QuantizationType::Product) { for batch in part_batches.iter_mut() { + if batch.num_rows() == 0 { + continue; + } + let codes = batch[PQ_CODE_COLUMN] .as_fixed_size_list() .values()