mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-12-23 11:12:51 +00:00
Support Map literal syntax for DuckDB and Generic (#1344)
This commit is contained in:
parent
71dc966586
commit
48ea5640a2
7 changed files with 219 additions and 0 deletions
|
|
@ -125,6 +125,28 @@ fn custom_statement_parser() -> Result<(), ParserError> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_map_syntax_not_support_default() -> Result<(), ParserError> {
|
||||
#[derive(Debug)]
|
||||
struct MyDialect {}
|
||||
|
||||
impl Dialect for MyDialect {
|
||||
fn is_identifier_start(&self, ch: char) -> bool {
|
||||
is_identifier_start(ch)
|
||||
}
|
||||
|
||||
fn is_identifier_part(&self, ch: char) -> bool {
|
||||
is_identifier_part(ch)
|
||||
}
|
||||
}
|
||||
|
||||
let dialect = MyDialect {};
|
||||
let sql = "SELECT MAP {1: 2}";
|
||||
let ast = Parser::parse_sql(&dialect, sql);
|
||||
assert!(ast.is_err());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn is_identifier_start(ch: char) -> bool {
|
||||
ch.is_ascii_lowercase() || ch.is_ascii_uppercase() || ch == '_'
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue