Skip to content

Commit 7701c54

Browse files
authored
Bug fix for the analyzer when reusing existing collector. (#319)
1 parent 1089414 commit 7701c54

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/builder/analyzer.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -444,16 +444,20 @@ impl DataScopeBuilder {
444444
schema: CollectorSchema,
445445
) -> Result<AnalyzedLocalCollectorReference> {
446446
let mut collectors = self.collectors.lock().unwrap();
447-
let collector_idx = collectors.len() as u32;
448-
match collectors.entry(collector_name) {
447+
let existing_len = collectors.len();
448+
let idx = match collectors.entry(collector_name) {
449449
indexmap::map::Entry::Occupied(mut entry) => {
450450
entry.get_mut().merge_schema(&schema)?;
451+
entry.index()
451452
}
452453
indexmap::map::Entry::Vacant(entry) => {
453454
entry.insert(CollectorBuilder::new(Arc::new(schema)));
455+
existing_len
454456
}
455-
}
456-
Ok(AnalyzedLocalCollectorReference { collector_idx })
457+
};
458+
Ok(AnalyzedLocalCollectorReference {
459+
collector_idx: idx as u32,
460+
})
457461
}
458462

459463
pub fn into_data_schema(self) -> Result<DataSchema> {

0 commit comments

Comments
 (0)