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

Function parse_group_by

nodedb-sql/src/planner/grouping_sets.rs:218–229  ·  view source on GitHub ↗
(sql: &str)

Source from the content-addressed store, hash-verified

216 use super::*;
217
218 fn parse_group_by(sql: &str) -> GroupByExpr {
219 use sqlparser::dialect::GenericDialect;
220 use sqlparser::parser::Parser;
221 let stmts = Parser::parse_sql(&GenericDialect {}, sql).unwrap();
222 match stmts.into_iter().next().unwrap() {
223 ast::Statement::Query(q) => match *q.body {
224 ast::SetExpr::Select(s) => s.group_by,
225 _ => panic!("expected SELECT"),
226 },
227 _ => panic!("expected query"),
228 }
229 }
230
231 #[test]
232 fn rollup_two_cols() {

Callers 6

rollup_two_colsFunction · 0.85
cube_two_colsFunction · 0.85
grouping_sets_explicitFunction · 0.85
mixed_plain_and_rollupFunction · 0.85
rollup_three_colsFunction · 0.85

Calls 2

parse_sqlFunction · 0.50
nextMethod · 0.45

Tested by 6

rollup_two_colsFunction · 0.68
cube_two_colsFunction · 0.68
grouping_sets_explicitFunction · 0.68
mixed_plain_and_rollupFunction · 0.68
rollup_three_colsFunction · 0.68