@@ -2329,25 +2329,21 @@ impl<'a> Parser<'a> {
2329
2329
2330
2330
/// Syntax
2331
2331
/// ```sql
2332
- /// -- typed, specific to bigquery
2332
+ /// -- typed
2333
2333
/// STRUCT<[field_name] field_type, ...>( expr1 [, ... ])
2334
2334
/// -- typeless
2335
2335
/// STRUCT( expr1 [AS field_name] [, ... ])
2336
2336
/// ```
2337
2337
fn parse_struct_literal(&mut self) -> Result<Expr, ParserError> {
2338
- let mut fields = vec![];
2339
- // Typed struct syntax is only supported by BigQuery
2340
- // https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#typed_struct_syntax
2341
- if self.dialect.supports_typed_struct_syntax() {
2342
- self.prev_token();
2343
- let trailing_bracket;
2344
- (fields, trailing_bracket) =
2345
- self.parse_struct_type_def(Self::parse_struct_field_def)?;
2346
- if trailing_bracket.0 {
2347
- return parser_err!("unmatched > in STRUCT literal", self.peek_token().location);
2348
- }
2338
+ // Parse the fields definition if exist `<[field_name] field_type, ...>`
2339
+ self.prev_token();
2340
+ let (fields, trailing_bracket) =
2341
+ self.parse_struct_type_def(Self::parse_struct_field_def)?;
2342
+ if trailing_bracket.0 {
2343
+ return parser_err!("unmatched > in STRUCT literal", self.peek_token().location);
2349
2344
}
2350
2345
2346
+ // Parse the struct values `(expr1 [, ... ])`
2351
2347
self.expect_token(&Token::LParen)?;
2352
2348
let values = self
2353
2349
.parse_comma_separated(|parser| parser.parse_struct_field_expr(!fields.is_empty()))?;
0 commit comments