Support Map literal syntax for DuckDB and Generic (#1344)

This commit is contained in:
Jax Liu 2024-07-21 20:18:50 +08:00 committed by GitHub
parent 71dc966586
commit 48ea5640a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 219 additions and 0 deletions

View file

@ -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 == '_'
}