MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / ingest_row_refs

Method ingest_row_refs

nodedb-columnar/src/memtable/mod.rs:181–198  ·  view source on GitHub ↗

Zero-copy row ingest for timeseries and high-throughput paths. Accepts borrowed values via `IngestValue<'_>`, avoiding string cloning for tag columns that are already interned in the `DictEncoded` dictionary.

(&mut self, values: &[IngestValue<'_>])

Source from the content-addressed store, hash-verified

179 /// Accepts borrowed values via `IngestValue<'_>`, avoiding string cloning
180 /// for tag columns that are already interned in the `DictEncoded` dictionary.
181 pub fn ingest_row_refs(&mut self, values: &[IngestValue<'_>]) -> Result<(), ColumnarError> {
182 if values.len() != self.schema.columns.len() {
183 return Err(ColumnarError::SchemaMismatch {
184 expected: self.schema.columns.len(),
185 got: values.len(),
186 });
187 }
188
189 for (i, (col_def, value)) in self.schema.columns.iter().zip(values.iter()).enumerate() {
190 if matches!(value, IngestValue::Null) && !col_def.nullable {
191 return Err(ColumnarError::NullViolation(col_def.name.clone()));
192 }
193 self.columns[i].push_ref(value, &col_def.name)?;
194 }
195
196 self.row_count += 1;
197 Ok(())
198 }
199
200 /// Add a new column to the schema, backfilling existing rows with nulls/defaults.
201 pub fn add_column(&mut self, name: String, column_type: ColumnType, nullable: bool) {

Callers

nothing calls this directly

Calls 4

lenMethod · 0.45
iterMethod · 0.45
cloneMethod · 0.45
push_refMethod · 0.45

Tested by

no test coverage detected