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

Function mixed_plain_and_rollup

nodedb-sql/src/planner/grouping_sets.rs:283–297  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

281
282 #[test]
283 fn mixed_plain_and_rollup() {
284 let gb = parse_group_by("SELECT a, b, c, SUM(x) FROM t GROUP BY a, ROLLUP (b, c)");
285 let result = expand_group_by(&gb).unwrap().unwrap();
286 // Canonical: a(0), b(1), c(2).
287 // Extension sets (from ROLLUP(b,c)): [[b,c], [b], []].
288 // Cross-product with plain [a]:
289 // set 0: [a, b, c] = [0,1,2]
290 // set 1: [a, b] = [0,1]
291 // set 2: [a] = [0]
292 assert_eq!(result.canonical_keys.len(), 3);
293 assert_eq!(result.grouping_sets.len(), 3);
294 assert!(result.grouping_sets[0].contains(&0)); // a always present
295 assert!(result.grouping_sets[1].contains(&0));
296 assert!(result.grouping_sets[2].contains(&0));
297 }
298
299 #[test]
300 fn rollup_three_cols() {

Callers

nothing calls this directly

Calls 2

parse_group_byFunction · 0.85
expand_group_byFunction · 0.85

Tested by

no test coverage detected