Remove "SQL" prefix from types

The rationale here is the same as the last commit: since this crate
exclusively parses SQL, there's no need to restate that in every type
name. (The prefix seems to be an artifact of this crate's history as a
submodule of Datafusion, where it was useful to explicitly call out
which types were related to SQL parsing.)

This commit has the additional benefit of making all type names
consistent; over type we'd added some types which were not prefixed with
"SQL".
This commit is contained in:
Nikhil Benesch 2019-06-24 13:26:35 -04:00
parent cf655ad1a6
commit ac555d7e86
No known key found for this signature in database
GPG key ID: FCF98542083C5A69
17 changed files with 818 additions and 836 deletions

View file

@ -57,7 +57,7 @@ impl TestedDialects {
})
}
pub fn parse_sql_statements(&self, sql: &str) -> Result<Vec<SQLStatement>, ParserError> {
pub fn parse_sql_statements(&self, sql: &str) -> Result<Vec<Statement>, ParserError> {
self.one_of_identical_results(|dialect| Parser::parse_sql(dialect, sql.to_string()))
// To fail the `ensure_multiple_dialects_are_tested` test:
// Parser::parse_sql(&**self.dialects.first().unwrap(), sql.to_string())
@ -66,7 +66,7 @@ impl TestedDialects {
/// Ensures that `sql` parses as a single statement, optionally checking
/// that converting AST back to string equals to `canonical` (unless an
/// empty canonical string is provided).
pub fn one_statement_parses_to(&self, sql: &str, canonical: &str) -> SQLStatement {
pub fn one_statement_parses_to(&self, sql: &str, canonical: &str) -> Statement {
let mut statements = self.parse_sql_statements(&sql).unwrap();
assert_eq!(statements.len(), 1);
@ -79,24 +79,24 @@ impl TestedDialects {
/// Ensures that `sql` parses as a single SQLStatement, and is not modified
/// after a serialization round-trip.
pub fn verified_stmt(&self, query: &str) -> SQLStatement {
pub fn verified_stmt(&self, query: &str) -> Statement {
self.one_statement_parses_to(query, query)
}
/// Ensures that `sql` parses as a single SQLQuery, and is not modified
/// after a serialization round-trip.
pub fn verified_query(&self, sql: &str) -> SQLQuery {
pub fn verified_query(&self, sql: &str) -> Query {
match self.verified_stmt(sql) {
SQLStatement::SQLQuery(query) => *query,
Statement::Query(query) => *query,
_ => panic!("Expected SQLQuery"),
}
}
/// Ensures that `sql` parses as a single SQLSelect, and is not modified
/// after a serialization round-trip.
pub fn verified_only_select(&self, query: &str) -> SQLSelect {
pub fn verified_only_select(&self, query: &str) -> Select {
match self.verified_query(query).body {
SQLSetExpr::Select(s) => *s,
SetExpr::Select(s) => *s,
_ => panic!("Expected SQLSetExpr::Select"),
}
}
@ -113,10 +113,10 @@ impl TestedDialects {
pub fn all_dialects() -> TestedDialects {
TestedDialects {
dialects: vec![
Box::new(GenericSqlDialect {}),
Box::new(GenericDialect {}),
Box::new(PostgreSqlDialect {}),
Box::new(MsSqlDialect {}),
Box::new(AnsiSqlDialect {}),
Box::new(AnsiDialect {}),
],
}
}
@ -130,9 +130,9 @@ pub fn only<T>(v: impl IntoIterator<Item = T>) -> T {
}
}
pub fn expr_from_projection(item: &SQLSelectItem) -> &Expr {
pub fn expr_from_projection(item: &SelectItem) -> &Expr {
match item {
SQLSelectItem::UnnamedExpr(expr) => expr,
SelectItem::UnnamedExpr(expr) => expr,
_ => panic!("Expected UnnamedExpr"),
}
}