#9422·lance

bug: IVF_RQ with the hamming metric panics in the kmeans trainer

Author: LuciferYangCreated Sep 18, 2026Updated Sep 18, 2026
Labelsbug

Description

Building an IVF_RQ index with metric_type = Hamming panics:

thread '...' panicked at rust/lance-index/src/vector/kmeans.rs:553:21:
KMeans::find_partitions: hamming is not supported

Nothing rejects the combination first. build_vector_index_impl in rust/lance/src/index/vector.rs checks the element type for the flat and PQ arms but not the metric, RabitQuantizer::build ignores the distance type entirely (its signature takes it as _), and the RQ transform's own "distance type not supported" error sits downstream of IVF training. So the build gets as far as assigning partitions and then panics inside kmeans.

The combination cannot be made to work: RaBitQ encodes residuals under L2 or dot, and Hamming is a binary-vector metric for UInt8 columns while RQ requires float vectors.

Expected behavior

Reject IVF_RQ with Hamming as invalid input before any training, the way the other unsupported combinations are rejected.

Lance version

13.0.0-beta.4 (main)

Language binding

Rust