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

Function parse_select

nodedb-sql/src/planner/aggregate.rs:400–411  ·  view source on GitHub ↗

Helper: parse a SQL SELECT and return the select body + projection.

(sql: &str)

Source from the content-addressed store, hash-verified

398
399 /// Helper: parse a SQL SELECT and return the select body + projection.
400 fn parse_select(sql: &str) -> ast::Select {
401 use sqlparser::dialect::GenericDialect;
402 use sqlparser::parser::Parser;
403 let stmts = Parser::parse_sql(&GenericDialect {}, sql).unwrap();
404 match stmts.into_iter().next().unwrap() {
405 ast::Statement::Query(q) => match *q.body {
406 ast::SetExpr::Select(s) => *s,
407 _ => panic!("expected SELECT"),
408 },
409 _ => panic!("expected query"),
410 }
411 }
412
413 #[test]
414 fn resolve_group_by_alias_to_time_bucket() {

Calls 2

parse_sqlFunction · 0.50
nextMethod · 0.45