forked from apache/datafusion-sqlparser-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsqlparser_databricks.rs
More file actions
30 lines (26 loc) · 825 Bytes
/
sqlparser_databricks.rs
File metadata and controls
30 lines (26 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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())))
);
}