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

Function apply_v_dense_rank

nodedb-query/src/window/value_eval.rs:259–288  ·  view source on GitHub ↗
(
    rows: &mut [Vec<Value>],
    indices: &[usize],
    column_index: &HashMap<String, usize>,
    spec: &WindowFuncSpec,
    write_col: usize,
)

Source from the content-addressed store, hash-verified

257}
258
259fn apply_v_dense_rank(
260 rows: &mut [Vec<Value>],
261 indices: &[usize],
262 column_index: &HashMap<String, usize>,
263 spec: &WindowFuncSpec,
264 write_col: usize,
265) {
266 if indices.is_empty() {
267 return;
268 }
269 let mut current_rank = 1usize;
270 set_cell(rows, indices[0], write_col, Value::Integer(1));
271 for pos in 1..indices.len() {
272 if !order_keys_equal_v(
273 rows,
274 indices[pos - 1],
275 indices[pos],
276 column_index,
277 &spec.order_by,
278 ) {
279 current_rank += 1;
280 }
281 set_cell(
282 rows,
283 indices[pos],
284 write_col,
285 Value::Integer(current_rank as i64),
286 );
287 }
288}
289
290fn apply_v_ntile(
291 rows: &mut [Vec<Value>],

Callers 1

Calls 4

set_cellFunction · 0.85
order_keys_equal_vFunction · 0.85
is_emptyMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected