ayman-sigma commented on code in PR #1542:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/1542#discussion_r1855271363


##########
src/parser/mod.rs:
##########
@@ -2328,19 +2327,25 @@ impl<'a> Parser<'a> {
         }
     }
 
-    /// Bigquery specific: Parse a struct literal
     /// Syntax
     /// ```sql
-    /// -- typed
+    /// -- typed, specific to bigquery
     /// STRUCT<[field_name] field_type, ...>( expr1 [, ... ])
     /// -- typeless
     /// STRUCT( expr1 [AS field_name] [, ... ])
     /// ```
-    fn parse_bigquery_struct_literal(&mut self) -> Result<Expr, ParserError> {
-        let (fields, trailing_bracket) =
-            self.parse_struct_type_def(Self::parse_struct_field_def)?;
-        if trailing_bracket.0 {
-            return parser_err!("unmatched > in STRUCT literal", 
self.peek_token().location);
+    fn parse_struct_literal(&mut self) -> Result<Expr, ParserError> {
+        let mut fields = vec![];
+        // Typed struct syntax is only supported by BigQuery
+        // 
https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#typed_struct_syntax
+        if self.dialect.supports_typed_struct_syntax() {

Review Comment:
   You are right, BigQuery struct is a superset of the Databricks struct. I 
wasn't sure if `supports_typed_struct_syntax` is too much or not. It sounds odd 
though that we would accept the syntax in Databricks even if it is invalid for 
this dialect. But I'm happy to change it if that is acceptable behavior for the 
parser.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to