fix(index): accept "RQ" when parsing QuantizationType - #8214
Merged
Xuanwo merged 1 commit intoAug 4, 2026
Conversation
`Display` writes "RQ" for `QuantizationType::Rabit` but `FromStr` only
accepted "RABIT", so the two never round-tripped.
`IvfIndexState::serialize` stores the quantization type with
`to_string()` and `deserialize` reads it back with
`parse::<QuantizationType>()`. For an IVF_RQ index the parse always
failed, and because `CacheCodec::deserialize` turns a body error into
`CacheDecode::Miss`, the failure was silent: the index simply never
reused its serialized state.
`Display` has to keep emitting "RQ" — `index_type_string` builds
`IVF_{quantization_type}` and `IndexType::try_from` expects "IVF_RQ" —
so the fix is on the `FromStr` side. "RABIT" stays accepted for headers
already on disk.
Co-Authored-By: Claude <noreply@anthropic.com>
Xuanwo
approved these changes
Aug 4, 2026
Xuanwo
left a comment
Collaborator
There was a problem hiding this comment.
Yes, I think this change makes sense
Contributor
Author
|
Thanks @Xuanwo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Display writes
"RQ"forQuantizationType::RabitbutFromStronly accepted"RABIT", so the two never round-tripped.IvfIndexState::serializestores the quantization type withto_string();deserializereads it back withparse::<QuantizationType>(). For an IVF_RQ index that parse always failed, and sinceCacheCodec::deserializeturns a body error intoCacheDecode::Miss, the failure was silent — the index just never reused its serialized state.Displayhas to keep emitting"RQ":index_type_stringbuildsIVF_{quantization_type}andIndexType::try_fromexpects"IVF_RQ". So the fix belongs on theFromStrside."RABIT"stays accepted for headers already on disk.The existing round-trip coverage missed this because
test_ivf_index_state_roundtriphardcodesQuantizationType::Flatand thetest_prewarm_and_query_with_serializing_backendcases are PQ and HNSW_SQ only. The new#[rstest]covers every variant.Testing
cargo test -p lance-index --lib vector::quantizer— 6 pass;case_5_rabitfails without the one-line fixcargo test -p lance-index --lib vector::— 331 passcargo fmt --all -- --check,cargo clippy -p lance-index --tests --benches -- -D warnings