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

Method fold

nodedb-array/src/tile/mbr.rs:97–129  ·  view source on GitHub ↗
(&mut self, coord: &[CoordValue], attrs: &[CellValue])

Source from the content-addressed store, hash-verified

95 }
96
97 pub fn fold(&mut self, coord: &[CoordValue], attrs: &[CellValue]) {
98 for (i, c) in coord.iter().take(self.arity).enumerate() {
99 let lo_replaces = self.dim_mins[i].as_ref().is_none_or(|cur| coord_lt(c, cur));
100 if lo_replaces {
101 self.dim_mins[i] = Some(c.clone());
102 }
103 let hi_replaces = self.dim_maxs[i].as_ref().is_none_or(|cur| coord_lt(cur, c));
104 if hi_replaces {
105 self.dim_maxs[i] = Some(c.clone());
106 }
107 }
108 for (i, a) in attrs.iter().take(self.n_attrs).enumerate() {
109 self.attr_total[i] += 1;
110 match a {
111 CellValue::Null => self.attr_nulls[i] += 1,
112 CellValue::Int64(v) => {
113 fold_numeric(&mut self.attr_min[i], &mut self.attr_max[i], *v as f64)
114 }
115 CellValue::Float64(v) => {
116 fold_numeric(&mut self.attr_min[i], &mut self.attr_max[i], *v)
117 }
118 CellValue::String(s) => {
119 self.attr_is_categorical[i] = true;
120 self.attr_distinct[i].insert(s.as_bytes().to_vec());
121 }
122 CellValue::Bytes(b) => {
123 self.attr_is_categorical[i] = true;
124 self.attr_distinct[i].insert(b.clone());
125 }
126 }
127 }
128 self.nnz += 1;
129 }
130
131 pub fn build(self) -> TileMBR {
132 let dim_mins = self.dim_mins.iter().map(coord_to_bound).collect();

Callers 15

st_distanceFunction · 0.80
overlapping_squaresFunction · 0.80
contained_squareFunction · 0.80
choose_best_axis_leafFunction · 0.80
choose_best_split_leafFunction · 0.80
normalized_roundtripFunction · 0.80
compose_prefiltersFunction · 0.80
maxsimFunction · 0.80

Calls 9

coord_ltFunction · 0.85
fold_numericFunction · 0.85
takeMethod · 0.45
iterMethod · 0.45
as_refMethod · 0.45
cloneMethod · 0.45
insertMethod · 0.45
to_vecMethod · 0.45
as_bytesMethod · 0.45

Tested by 9

overlapping_squaresFunction · 0.64
contained_squareFunction · 0.64
normalized_roundtripFunction · 0.64
mbr_numeric_attr_statsFunction · 0.64
mbr_all_null_attrFunction · 0.64