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

Function running_sum

nodedb-query/src/window/eval.rs:133–149  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

131
132 #[test]
133 fn running_sum() {
134 let mut rows = make_rows();
135 let spec = WindowFuncSpec {
136 alias: "running_total".into(),
137 func_name: "sum".into(),
138 args: vec![SqlExpr::Column("salary".into())],
139 partition_by: vec![SqlExpr::Column("dept".into())],
140 order_by: vec![(SqlExpr::Column("salary".into()), true)],
141 frame: WindowFrame::default(),
142 };
143 evaluate_window_functions(&mut rows, &[spec]);
144 assert_eq!(rows[0].1["running_total"], json!(100.0));
145 assert_eq!(rows[1].1["running_total"], json!(220.0));
146 assert_eq!(rows[2].1["running_total"], json!(310.0));
147 assert_eq!(rows[3].1["running_total"], json!(80.0));
148 assert_eq!(rows[4].1["running_total"], json!(190.0));
149 }
150
151 #[test]
152 fn percent_rank_distinct_keys() {

Callers

nothing calls this directly

Calls 2

make_rowsFunction · 0.85

Tested by

no test coverage detected