fix: panic when field id doesn't equal to field index (#2116)

Signed-off-by: BubbleCal <bubble-cal@outlook.com>
This commit is contained in:
BubbleCal
2025-02-13 12:38:35 +08:00
committed by GitHub
parent 78a17ad54c
commit 3b19e96ae7
2 changed files with 17 additions and 5 deletions
+13 -1
View File
@@ -23,7 +23,19 @@ impl VectorIndex {
let fields = index
.fields
.iter()
.map(|i| manifest.schema.fields[*i as usize].name.clone())
.map(|field_id| {
manifest
.schema
.field_by_id(*field_id)
.unwrap_or_else(|| {
panic!(
"field {field_id} of index {} must exist in schema",
index.name
)
})
.name
.clone()
})
.collect();
Self {
columns: fields,