vector: cover index names in named_segment_fragments (#12161)

vector: cover the index name in named_segment_fragments

The planner groups tasks by index name — assert the helper actually
returns the logical name so a regression dropping it fails.
This commit is contained in:
Chris Lu authored and GitHub committed 2026-10-28 01:48:24 -07:00
1 parent d5433ae745
commit 7a25983266
1 file changed
+27
@@ -194,6 +194,33 @@ mod tests {
assert_eq!(got, want);
}
/// named_segment_fragments must carry the logical index name through —
/// a fanout planner groups tasks by name.
#[tokio::test]
async fn named_segment_fragments_returns_index_names() {
let dir = TempDir::new().unwrap();
let mut dataset = testing::write_dataset(
&dir,
&testing::vectors(8, 4),
&["a", "b", "c", "d", "e", "f", "g", "h"],
)
.await;
let params = VectorIndexParams::ivf_flat(4, DistanceType::L2);
dataset
.create_index(
&["vector"],
IndexType::Vector,
Some("shard-a".to_string()),
&params,
false,
)
.await
.unwrap();
let named = named_segment_fragments(&dataset, "vector").await.unwrap();
assert!(!named.is_empty());
assert!(named.iter().all(|(_, name, _)| name == "shard-a"));
}
/// A scope of fragment ids that no longer exist, an empty list, or an
/// empty-segment assignment must return no hits — never fall through to
/// an unrestricted scan.