@@ -2936,7 +2936,7 @@ impl<'a> Parser<'a> {
29362936 } else if Token::LBracket == tok {
29372937 if dialect_of!(self is PostgreSqlDialect | DuckDbDialect | GenericDialect) {
29382938 self.parse_subscript(expr)
2939- } else if dialect_of!(self is SnowflakeDialect) {
2939+ } else if dialect_of!(self is SnowflakeDialect) || self.dialect.supports_partiql() {
29402940 self.prev_token();
29412941 self.parse_json_access(expr)
29422942 } else {
@@ -3072,6 +3072,14 @@ impl<'a> Parser<'a> {
30723072 }
30733073
30743074 fn parse_json_access(&mut self, expr: Expr) -> Result<Expr, ParserError> {
3075+ let path = self.parse_json_path()?;
3076+ Ok(Expr::JsonAccess {
3077+ value: Box::new(expr),
3078+ path,
3079+ })
3080+ }
3081+
3082+ fn parse_json_path(&mut self) -> Result<JsonPath, ParserError> {
30753083 let mut path = Vec::new();
30763084 loop {
30773085 match self.next_token().token {
@@ -3095,10 +3103,7 @@ impl<'a> Parser<'a> {
30953103 }
30963104
30973105 debug_assert!(!path.is_empty());
3098- Ok(Expr::JsonAccess {
3099- value: Box::new(expr),
3100- path: JsonPath { path },
3101- })
3106+ Ok(JsonPath{ path })
31023107 }
31033108
31043109 pub fn parse_map_access(&mut self, expr: Expr) -> Result<Expr, ParserError> {
@@ -10322,7 +10327,12 @@ impl<'a> Parser<'a> {
1032210327 self.parse_open_json_table_factor()
1032310328 } else {
1032410329 let name = self.parse_object_name(true)?;
10325-
10330+
10331+ let partiql = match self.peek_token().token {
10332+ Token::LBracket if self.dialect.supports_partiql() => Some(self.parse_json_path()?),
10333+ _ => None
10334+ };
10335+
1032610336 let partitions: Vec<Ident> = if dialect_of!(self is MySqlDialect | GenericDialect)
1032710337 && self.parse_keyword(Keyword::PARTITION)
1032810338 {
@@ -10365,6 +10375,7 @@ impl<'a> Parser<'a> {
1036510375 version,
1036610376 partitions,
1036710377 with_ordinality,
10378+ partiql,
1036810379 };
1036910380
1037010381 while let Some(kw) = self.parse_one_of_keywords(&[Keyword::PIVOT, Keyword::UNPIVOT]) {
0 commit comments