mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-22 06:54:07 +00:00
Initial Databricks SQL dialect (#1220)
This commit is contained in:
parent
0adf4c675c
commit
2490034948
6 changed files with 135 additions and 18 deletions
30
tests/sqlparser_databricks.rs
Normal file
30
tests/sqlparser_databricks.rs
Normal file
|
@ -0,0 +1,30 @@
|
|||
use sqlparser::ast::*;
|
||||
use sqlparser::dialect::DatabricksDialect;
|
||||
use test_utils::*;
|
||||
|
||||
#[macro_use]
|
||||
mod test_utils;
|
||||
|
||||
fn databricks() -> TestedDialects {
|
||||
TestedDialects {
|
||||
dialects: vec![Box::new(DatabricksDialect {})],
|
||||
options: None,
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_databricks_identifiers() {
|
||||
// databricks uses backtick for delimited identifiers
|
||||
assert_eq!(
|
||||
databricks().verified_only_select("SELECT `Ä`").projection[0],
|
||||
SelectItem::UnnamedExpr(Expr::Identifier(Ident::with_quote('`', "Ä")))
|
||||
);
|
||||
|
||||
// double quotes produce string literals, not delimited identifiers
|
||||
assert_eq!(
|
||||
databricks()
|
||||
.verified_only_select(r#"SELECT "Ä""#)
|
||||
.projection[0],
|
||||
SelectItem::UnnamedExpr(Expr::Value(Value::DoubleQuotedString("Ä".to_owned())))
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue