Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
mertak-synnada committed Aug 29, 2024
1 parent 0f31847 commit 7d222ff
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/ast/dml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ pub struct CreateTable {
pub collation: Option<String>,
pub on_commit: Option<OnCommit>,
/// Datafusion "WITH ORDER" clause
/// https://datafusion.apache.org/user-guide/sql/ddl.html#create-external-table
/// <https://datafusion.apache.org/user-guide/sql/ddl.html#create-external-table/>
pub with_order: Vec<Vec<OrderByExpr>>,
/// ClickHouse "ON CLUSTER" clause:
/// <https://clickhouse.com/docs/en/sql-reference/distributed-ddl/>
Expand Down
48 changes: 24 additions & 24 deletions src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12347,35 +12347,35 @@ mod tests {
let sql = "CREATE TABLE test (foo INT, bar VARCHAR(256)) WITH ORDER (foo ASC)";
let ast = Parser::parse_sql(&GenericDialect {}, sql).unwrap();
match ast[0].clone() {
Statement::CreateTable(CreateTable {
with_order,
..
}) => {
assert_eq!(with_order, vec![vec![OrderByExpr{
expr: Expr::Identifier(Ident::from("foo")),
asc: Some(true),
nulls_first: None,
with_fill: None,
}]]);
},
_ => unreachable!()
Statement::CreateTable(CreateTable { with_order, .. }) => {
assert_eq!(
with_order,
vec![vec![OrderByExpr {
expr: Expr::Identifier(Ident::from("foo")),
asc: Some(true),
nulls_first: None,
with_fill: None,
}]]
);
}
_ => unreachable!(),
}

let sql = "CREATE TABLE test (foo INT, bar VARCHAR(256)) WITH ORDER (bar DESC NULLS FIRST)";
let ast = Parser::parse_sql(&GenericDialect {}, sql).unwrap();
match ast[0].clone() {
Statement::CreateTable(CreateTable {
with_order,
..
}) => {
assert_eq!(with_order, vec![vec![OrderByExpr{
expr: Expr::Identifier(Ident::from("bar")),
asc: Some(false),
nulls_first: Some(true),
with_fill: None,
}]]);
},
_ => unreachable!()
Statement::CreateTable(CreateTable { with_order, .. }) => {
assert_eq!(
with_order,
vec![vec![OrderByExpr {
expr: Expr::Identifier(Ident::from("bar")),
asc: Some(false),
nulls_first: Some(true),
with_fill: None,
}]]
);
}
_ => unreachable!(),
}
}

Expand Down

0 comments on commit 7d222ff

Please sign in to comment.