mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-07 17:04:59 +00:00
Snowflake ALTER TABLE clustering options (#1579)
This commit is contained in:
parent
7b50ac31c3
commit
d0fcc06652
5 changed files with 123 additions and 15 deletions
|
@ -1411,6 +1411,42 @@ fn test_alter_table_swap_with() {
|
|||
};
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_alter_table_clustering() {
|
||||
let sql = r#"ALTER TABLE tab CLUSTER BY (c1, "c2", TO_DATE(c3))"#;
|
||||
match alter_table_op(snowflake_and_generic().verified_stmt(sql)) {
|
||||
AlterTableOperation::ClusterBy { exprs } => {
|
||||
assert_eq!(
|
||||
exprs,
|
||||
[
|
||||
Expr::Identifier(Ident::new("c1")),
|
||||
Expr::Identifier(Ident::with_quote('"', "c2")),
|
||||
Expr::Function(Function {
|
||||
name: ObjectName(vec![Ident::new("TO_DATE")]),
|
||||
parameters: FunctionArguments::None,
|
||||
args: FunctionArguments::List(FunctionArgumentList {
|
||||
args: vec![FunctionArg::Unnamed(FunctionArgExpr::Expr(
|
||||
Expr::Identifier(Ident::new("c3"))
|
||||
))],
|
||||
duplicate_treatment: None,
|
||||
clauses: vec![],
|
||||
}),
|
||||
filter: None,
|
||||
null_treatment: None,
|
||||
over: None,
|
||||
within_group: vec![]
|
||||
})
|
||||
],
|
||||
);
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
||||
snowflake_and_generic().verified_stmt("ALTER TABLE tbl DROP CLUSTERING KEY");
|
||||
snowflake_and_generic().verified_stmt("ALTER TABLE tbl SUSPEND RECLUSTER");
|
||||
snowflake_and_generic().verified_stmt("ALTER TABLE tbl RESUME RECLUSTER");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_drop_stage() {
|
||||
match snowflake_and_generic().verified_stmt("DROP STAGE s1") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue