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

Function apply_v_lead

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

417}
418
419fn apply_v_lead(
420 rows: &mut [Vec<Value>],
421 indices: &[usize],
422 column_index: &HashMap<String, usize>,
423 spec: &WindowFuncSpec,
424 write_col: usize,
425) -> Result<(), WindowError> {
426 let offset = usize_arg(spec, 1, 1);
427 let default = default_arg_value(spec, 2);
428 let values = collect_arg_values(rows, indices, column_index, spec);
429 for (pos, &i) in indices.iter().enumerate() {
430 let val = if pos + offset < indices.len() {
431 values[pos + offset].clone()
432 } else {
433 default.clone()
434 };
435 set_cell(rows, i, write_col, val);
436 }
437 Ok(())
438}
439
440fn apply_v_nth_value(
441 rows: &mut [Vec<Value>],

Callers 1

Calls 7

default_arg_valueFunction · 0.85
collect_arg_valuesFunction · 0.85
set_cellFunction · 0.85
usize_argFunction · 0.70
iterMethod · 0.45
lenMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected