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

Function index_rows

nodedb-array/src/query/elementwise.rs:139–152  ·  view source on GitHub ↗
(tile: &SparseTile)

Source from the content-addressed store, hash-verified

137}
138
139fn index_rows(tile: &SparseTile) -> BTreeMap<Vec<CoordKey>, Vec<CellValue>> {
140 let mut out = BTreeMap::new();
141 let n = tile.nnz() as usize;
142 for row in 0..n {
143 let coord: Vec<CoordValue> = tile
144 .dim_dicts
145 .iter()
146 .map(|d| d.values[d.indices[row] as usize].clone())
147 .collect();
148 let attrs: Vec<CellValue> = tile.attr_cols.iter().map(|col| col[row].clone()).collect();
149 out.insert(encode_key(&coord), attrs);
150 }
151 out
152}
153
154#[cfg(test)]
155mod tests {

Callers 1

elementwiseFunction · 0.85

Calls 6

encode_keyFunction · 0.85
collectMethod · 0.80
nnzMethod · 0.45
iterMethod · 0.45
cloneMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected