mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-07 17:04:59 +00:00
Support "with" identifiers surrounded by backticks in GenericDialect
(#1010)
This commit is contained in:
parent
57090537f0
commit
9832adb376
2 changed files with 17 additions and 8 deletions
|
@ -20,7 +20,7 @@ use sqlparser::ast::{
|
|||
SelectItem, Statement, TableFactor, UnaryOperator, Value,
|
||||
};
|
||||
use sqlparser::dialect::{GenericDialect, HiveDialect};
|
||||
use sqlparser::parser::ParserError;
|
||||
use sqlparser::parser::{ParserError, ParserOptions};
|
||||
use sqlparser::test_utils::*;
|
||||
|
||||
#[test]
|
||||
|
@ -32,6 +32,20 @@ fn parse_table_create() {
|
|||
hive().verified_stmt(iof);
|
||||
}
|
||||
|
||||
fn generic(options: Option<ParserOptions>) -> TestedDialects {
|
||||
TestedDialects {
|
||||
dialects: vec![Box::new(GenericDialect {})],
|
||||
options,
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_describe() {
|
||||
let describe = r#"DESCRIBE namespace.`table`"#;
|
||||
hive().verified_stmt(describe);
|
||||
generic(None).verified_stmt(describe);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_insert_overwrite() {
|
||||
let insert_partitions = r#"INSERT OVERWRITE TABLE db.new_table PARTITION (a = '1', b) SELECT a, b, c FROM db.table"#;
|
||||
|
@ -265,13 +279,8 @@ fn parse_create_function() {
|
|||
_ => unreachable!(),
|
||||
}
|
||||
|
||||
let generic = TestedDialects {
|
||||
dialects: vec![Box::new(GenericDialect {})],
|
||||
options: None,
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
generic.parse_sql_statements(sql).unwrap_err(),
|
||||
generic(None).parse_sql_statements(sql).unwrap_err(),
|
||||
ParserError::ParserError(
|
||||
"Expected an object type after CREATE, found: FUNCTION".to_string()
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue