mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-29 10:24:06 +00:00
Re-run cargo fmt
This commit is contained in:
parent
23a0fc79f5
commit
f30ab89ad2
3 changed files with 26 additions and 5 deletions
|
@ -348,9 +348,18 @@ impl ToString for SQLStatement {
|
||||||
}
|
}
|
||||||
s
|
s
|
||||||
}
|
}
|
||||||
SQLStatement::SQLCreateView { name, query, materialized } => {
|
SQLStatement::SQLCreateView {
|
||||||
|
name,
|
||||||
|
query,
|
||||||
|
materialized,
|
||||||
|
} => {
|
||||||
let modifier = if *materialized { " MATERIALIZED" } else { "" };
|
let modifier = if *materialized { " MATERIALIZED" } else { "" };
|
||||||
format!("CREATE{} VIEW {} AS {}", modifier, name.to_string(), query.to_string())
|
format!(
|
||||||
|
"CREATE{} VIEW {} AS {}",
|
||||||
|
modifier,
|
||||||
|
name.to_string(),
|
||||||
|
query.to_string()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
SQLStatement::SQLCreateTable { name, columns } => format!(
|
SQLStatement::SQLCreateTable { name, columns } => format!(
|
||||||
"CREATE TABLE {} ({})",
|
"CREATE TABLE {} ({})",
|
||||||
|
|
|
@ -640,7 +640,11 @@ impl Parser {
|
||||||
self.expect_keyword("AS")?;
|
self.expect_keyword("AS")?;
|
||||||
let query = self.parse_query()?;
|
let query = self.parse_query()?;
|
||||||
// Optional `WITH [ CASCADED | LOCAL ] CHECK OPTION` is widely supported here.
|
// Optional `WITH [ CASCADED | LOCAL ] CHECK OPTION` is widely supported here.
|
||||||
Ok(SQLStatement::SQLCreateView { name, query, materialized })
|
Ok(SQLStatement::SQLCreateView {
|
||||||
|
name,
|
||||||
|
query,
|
||||||
|
materialized,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn parse_create_table(&mut self) -> Result<SQLStatement, ParserError> {
|
pub fn parse_create_table(&mut self) -> Result<SQLStatement, ParserError> {
|
||||||
|
|
|
@ -901,7 +901,11 @@ fn parse_scalar_subqueries() {
|
||||||
fn parse_create_view() {
|
fn parse_create_view() {
|
||||||
let sql = "CREATE VIEW myschema.myview AS SELECT foo FROM bar";
|
let sql = "CREATE VIEW myschema.myview AS SELECT foo FROM bar";
|
||||||
match verified_stmt(sql) {
|
match verified_stmt(sql) {
|
||||||
SQLStatement::SQLCreateView { name, query, materialized } => {
|
SQLStatement::SQLCreateView {
|
||||||
|
name,
|
||||||
|
query,
|
||||||
|
materialized,
|
||||||
|
} => {
|
||||||
assert_eq!("myschema.myview", name.to_string());
|
assert_eq!("myschema.myview", name.to_string());
|
||||||
assert_eq!("SELECT foo FROM bar", query.to_string());
|
assert_eq!("SELECT foo FROM bar", query.to_string());
|
||||||
assert!(!materialized);
|
assert!(!materialized);
|
||||||
|
@ -914,7 +918,11 @@ fn parse_create_view() {
|
||||||
fn parse_create_materialized_view() {
|
fn parse_create_materialized_view() {
|
||||||
let sql = "CREATE MATERIALIZED VIEW myschema.myview AS SELECT foo FROM bar";
|
let sql = "CREATE MATERIALIZED VIEW myschema.myview AS SELECT foo FROM bar";
|
||||||
match verified_stmt(sql) {
|
match verified_stmt(sql) {
|
||||||
SQLStatement::SQLCreateView { name, query, materialized } => {
|
SQLStatement::SQLCreateView {
|
||||||
|
name,
|
||||||
|
query,
|
||||||
|
materialized,
|
||||||
|
} => {
|
||||||
assert_eq!("myschema.myview", name.to_string());
|
assert_eq!("myschema.myview", name.to_string());
|
||||||
assert_eq!("SELECT foo FROM bar", query.to_string());
|
assert_eq!("SELECT foo FROM bar", query.to_string());
|
||||||
assert!(materialized);
|
assert!(materialized);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue