mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-07 17:04:59 +00:00
Add support for Databricks TIMESTAMP_NTZ. (#1781)
Co-authored-by: Roman Borschel <roman@cluvio.com>
This commit is contained in:
parent
95d7b86da5
commit
91327bb0c0
4 changed files with 47 additions and 0 deletions
|
@ -317,3 +317,43 @@ fn parse_databricks_struct_function() {
|
|||
})
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn data_type_timestamp_ntz() {
|
||||
// Literal
|
||||
assert_eq!(
|
||||
databricks().verified_expr("TIMESTAMP_NTZ '2025-03-29T18:52:00'"),
|
||||
Expr::TypedString {
|
||||
data_type: DataType::TimestampNtz,
|
||||
value: Value::SingleQuotedString("2025-03-29T18:52:00".to_owned())
|
||||
}
|
||||
);
|
||||
|
||||
// Cast
|
||||
assert_eq!(
|
||||
databricks().verified_expr("(created_at)::TIMESTAMP_NTZ"),
|
||||
Expr::Cast {
|
||||
kind: CastKind::DoubleColon,
|
||||
expr: Box::new(Expr::Nested(Box::new(Expr::Identifier(
|
||||
"created_at".into()
|
||||
)))),
|
||||
data_type: DataType::TimestampNtz,
|
||||
format: None
|
||||
}
|
||||
);
|
||||
|
||||
// Column definition
|
||||
match databricks().verified_stmt("CREATE TABLE foo (x TIMESTAMP_NTZ)") {
|
||||
Statement::CreateTable(CreateTable { columns, .. }) => {
|
||||
assert_eq!(
|
||||
columns,
|
||||
vec![ColumnDef {
|
||||
name: "x".into(),
|
||||
data_type: DataType::TimestampNtz,
|
||||
options: vec![],
|
||||
}]
|
||||
);
|
||||
}
|
||||
s => panic!("Unexpected statement: {:?}", s),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue