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

Function apply_v_cume_dist

nodedb-query/src/window/value_eval.rs:341–373  ·  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

339}
340
341fn apply_v_cume_dist(
342 rows: &mut [Vec<Value>],
343 indices: &[usize],
344 column_index: &HashMap<String, usize>,
345 spec: &WindowFuncSpec,
346 write_col: usize,
347) {
348 let total = indices.len();
349 if total == 0 {
350 return;
351 }
352 let denom = total as f64;
353 let mut group_start = 0;
354 while group_start < total {
355 let mut group_end = group_start + 1;
356 while group_end < total
357 && order_keys_equal_v(
358 rows,
359 indices[group_start],
360 indices[group_end],
361 column_index,
362 &spec.order_by,
363 )
364 {
365 group_end += 1;
366 }
367 let cd = group_end as f64 / denom;
368 for &idx in &indices[group_start..group_end] {
369 set_cell(rows, idx, write_col, Value::Float(cd));
370 }
371 group_start = group_end;
372 }
373}
374
375// ── Offset functions ──────────────────────────────────────────────────────────
376

Callers 1

Calls 3

order_keys_equal_vFunction · 0.85
set_cellFunction · 0.85
lenMethod · 0.45

Tested by

no test coverage detected