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

Function cume_dist_distinct_keys

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

Source from the content-addressed store, hash-verified

194
195 #[test]
196 fn cume_dist_distinct_keys() {
197 let mut rows = numbered(5);
198 let spec = WindowFuncSpec {
199 alias: "cd".into(),
200 func_name: "cume_dist".into(),
201 args: vec![],
202 partition_by: vec![],
203 order_by: vec![(SqlExpr::Column("n".into()), true)],
204 frame: WindowFrame::default(),
205 };
206 evaluate_window_functions(&mut rows, &[spec]);
207 assert_eq!(rows[0].1["cd"], json!(0.2));
208 assert_eq!(rows[1].1["cd"], json!(0.4));
209 assert_eq!(rows[2].1["cd"], json!(0.6));
210 assert_eq!(rows[3].1["cd"], json!(0.8));
211 assert_eq!(rows[4].1["cd"], json!(1.0));
212 }
213
214 #[test]
215 fn cume_dist_with_peers() {

Callers

nothing calls this directly

Calls 2

numberedFunction · 0.70

Tested by

no test coverage detected