fix: Assert that there aren't two columns with the same name in the same batch
This shouldn't be possible; let's make sure we know if it happens!pull/24376/head
parent
9b0af96927
commit
74a40cc9bd
|
@ -218,7 +218,12 @@ where
|
|||
}
|
||||
None => {
|
||||
// column doesn't exist; add it
|
||||
column_batch.insert(tag.name.as_str(), ColumnType::Tag);
|
||||
let old = column_batch.insert(tag.name.as_str(), ColumnType::Tag);
|
||||
assert!(
|
||||
old.is_none(),
|
||||
"duplicate column name `{}` in new column batch shouldn't be possible",
|
||||
tag.name
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -251,7 +256,13 @@ where
|
|||
}
|
||||
None => {
|
||||
// column doesn't exist; add it
|
||||
column_batch.insert(field.name.as_str(), ColumnType::from(influx_column_type));
|
||||
let old = column_batch
|
||||
.insert(field.name.as_str(), ColumnType::from(influx_column_type));
|
||||
assert!(
|
||||
old.is_none(),
|
||||
"duplicate column name `{}` in new column batch shouldn't be possible",
|
||||
field.name
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -176,7 +176,11 @@ where
|
|||
None => {
|
||||
// The column does not exist in the cache, add it to the column
|
||||
// batch to be bulk inserted later.
|
||||
column_batch.insert(name.as_str(), ColumnType::from(col.influx_type()));
|
||||
let old = column_batch.insert(name.as_str(), ColumnType::from(col.influx_type()));
|
||||
assert!(
|
||||
old.is_none(),
|
||||
"duplicate column name `{name}` in new column batch shouldn't be possible"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue