mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-31 11:17:23 +00:00
BigQuery: support of CREATE VIEW IF NOT EXISTS (#1118)
This commit is contained in:
parent
8fae601743
commit
60baea4ae7
2 changed files with 31 additions and 1 deletions
|
@ -175,6 +175,36 @@ fn parse_create_view_with_options() {
|
|||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn parse_create_view_if_not_exists() {
|
||||
let sql = "CREATE VIEW IF NOT EXISTS mydataset.newview AS SELECT foo FROM bar";
|
||||
match bigquery().verified_stmt(sql) {
|
||||
Statement::CreateView {
|
||||
name,
|
||||
columns,
|
||||
query,
|
||||
or_replace,
|
||||
materialized,
|
||||
options,
|
||||
cluster_by,
|
||||
with_no_schema_binding: late_binding,
|
||||
if_not_exists,
|
||||
temporary,
|
||||
} => {
|
||||
assert_eq!("mydataset.newview", name.to_string());
|
||||
assert_eq!(Vec::<ViewColumnDef>::new(), columns);
|
||||
assert_eq!("SELECT foo FROM bar", query.to_string());
|
||||
assert!(!materialized);
|
||||
assert!(!or_replace);
|
||||
assert_eq!(options, CreateTableOptions::None);
|
||||
assert_eq!(cluster_by, vec![]);
|
||||
assert!(!late_binding);
|
||||
assert!(if_not_exists);
|
||||
assert!(!temporary);
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_create_table_with_options() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue