This is an automated email from the ASF dual-hosted git repository.

iffyio pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git


The following commit(s) were added to refs/heads/main by this push:
     new 74163b14 Add support for parsing empty dictionary expressions (#1684)
74163b14 is described below

commit 74163b148ed984cb73146699998f615f7b22a642
Author: Yoav Cohen <59807311+yoavcl...@users.noreply.github.com>
AuthorDate: Sun Jan 26 15:20:00 2025 +0100

    Add support for parsing empty dictionary expressions (#1684)
---
 src/parser/mod.rs         | 3 ++-
 tests/sqlparser_common.rs | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/parser/mod.rs b/src/parser/mod.rs
index 9cc8f062..0d2973c7 100644
--- a/src/parser/mod.rs
+++ b/src/parser/mod.rs
@@ -2854,7 +2854,8 @@ impl<'a> Parser<'a> {
     fn parse_duckdb_struct_literal(&mut self) -> Result<Expr, ParserError> {
         self.expect_token(&Token::LBrace)?;
 
-        let fields = 
self.parse_comma_separated(Self::parse_duckdb_dictionary_field)?;
+        let fields =
+            self.parse_comma_separated0(Self::parse_duckdb_dictionary_field, 
Token::RBrace)?;
 
         self.expect_token(&Token::RBrace)?;
 
diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs
index 6897d44a..5a1e812d 100644
--- a/tests/sqlparser_common.rs
+++ b/tests/sqlparser_common.rs
@@ -11291,6 +11291,8 @@ fn test_dictionary_syntax() {
         );
     }
 
+    check("{}", Expr::Dictionary(vec![]));
+
     check(
         "{'Alberta': 'Edmonton', 'Manitoba': 'Winnipeg'}",
         Expr::Dictionary(vec![


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@datafusion.apache.org
For additional commands, e-mail: commits-h...@datafusion.apache.org

Reply via email to