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

Function rollup_two_cols

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

Source from the content-addressed store, hash-verified

230
231 #[test]
232 fn rollup_two_cols() {
233 let gb = parse_group_by(
234 "SELECT region, country, SUM(sales) FROM orders GROUP BY ROLLUP (region, country)",
235 );
236 let result = expand_group_by(&gb).unwrap().unwrap();
237 // ROLLUP(region, country) → [[0,1], [0], []]
238 assert_eq!(result.canonical_keys.len(), 2);
239 assert_eq!(result.grouping_sets.len(), 3);
240 assert_eq!(result.grouping_sets[0], vec![0, 1]); // (region, country)
241 assert_eq!(result.grouping_sets[1], vec![0]); // (region)
242 assert_eq!(result.grouping_sets[2], Vec::<usize>::new()); // ()
243 }
244
245 #[test]
246 fn cube_two_cols() {

Callers

nothing calls this directly

Calls 2

parse_group_byFunction · 0.85
expand_group_byFunction · 0.85

Tested by

no test coverage detected