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

Function cube_two_cols

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

Source from the content-addressed store, hash-verified

244
245 #[test]
246 fn cube_two_cols() {
247 let gb = parse_group_by(
248 "SELECT region, country, SUM(sales) FROM orders GROUP BY CUBE (region, country)",
249 );
250 let result = expand_group_by(&gb).unwrap().unwrap();
251 // CUBE(region, country) → [[0,1], [0], [1], []]
252 assert_eq!(result.canonical_keys.len(), 2);
253 assert_eq!(result.grouping_sets.len(), 4);
254 // All-present first.
255 assert!(result.grouping_sets[0].contains(&0));
256 assert!(result.grouping_sets[0].contains(&1));
257 // Empty set last.
258 assert_eq!(*result.grouping_sets.last().unwrap(), Vec::<usize>::new());
259 }
260
261 #[test]
262 fn grouping_sets_explicit() {

Callers

nothing calls this directly

Calls 2

parse_group_byFunction · 0.85
expand_group_byFunction · 0.85

Tested by

no test coverage detected