mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-08 01:15:00 +00:00
30 lines
825 B
Rust
30 lines
825 B
Rust
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())))
|
|
);
|
|
}
|