datafusion-sqlparse/tests/sqlparser_ansi.rs
Nickolay Ponomarev bf0c07bb1b Support basic CTEs (WITH)
Some unsupported features are noted as TODOs.
2019-02-11 05:13:48 +03:00

22 lines
600 B
Rust

extern crate log;
extern crate sqlparser;
use sqlparser::dialect::AnsiSqlDialect;
use sqlparser::sqlast::*;
use sqlparser::sqlparser::*;
#[test]
fn parse_simple_select() {
let sql = String::from("SELECT id, fname, lname FROM customer WHERE id = 1");
let ast = Parser::parse_sql(&AnsiSqlDialect {}, sql).unwrap();
assert_eq!(1, ast.len());
match ast.first().unwrap() {
SQLStatement::SQLSelect(SQLQuery {
body: SQLSelect { projection, .. },
..
}) => {
assert_eq!(3, projection.len());
}
_ => assert!(false),
}
}