@@ -2920,7 +2920,7 @@ impl<'a> Parser<'a> {
29202920 } else if Token::LBracket == tok {
29212921 if dialect_of!(self is PostgreSqlDialect | DuckDbDialect | GenericDialect) {
29222922 self.parse_subscript(expr)
2923- } else if dialect_of!(self is SnowflakeDialect) {
2923+ } else if dialect_of!(self is SnowflakeDialect) || self.dialect.supports_partiql() {
29242924 self.prev_token();
29252925 self.parse_json_access(expr)
29262926 } else {
@@ -3056,6 +3056,14 @@ impl<'a> Parser<'a> {
30563056 }
30573057
30583058 fn parse_json_access(&mut self, expr: Expr) -> Result<Expr, ParserError> {
3059+ let path = self.parse_json_path()?;
3060+ Ok(Expr::JsonAccess {
3061+ value: Box::new(expr),
3062+ path,
3063+ })
3064+ }
3065+
3066+ fn parse_json_path(&mut self) -> Result<JsonPath, ParserError> {
30593067 let mut path = Vec::new();
30603068 loop {
30613069 match self.next_token().token {
@@ -3079,10 +3087,7 @@ impl<'a> Parser<'a> {
30793087 }
30803088
30813089 debug_assert!(!path.is_empty());
3082- Ok(Expr::JsonAccess {
3083- value: Box::new(expr),
3084- path: JsonPath { path },
3085- })
3090+ Ok(JsonPath{ path })
30863091 }
30873092
30883093 pub fn parse_map_access(&mut self, expr: Expr) -> Result<Expr, ParserError> {
@@ -10306,7 +10311,12 @@ impl<'a> Parser<'a> {
1030610311 self.parse_open_json_table_factor()
1030710312 } else {
1030810313 let name = self.parse_object_name(true)?;
10309-
10314+
10315+ let partiql = match self.peek_token().token {
10316+ Token::LBracket if self.dialect.supports_partiql() => Some(self.parse_json_path()?),
10317+ _ => None
10318+ };
10319+
1031010320 let partitions: Vec<Ident> = if dialect_of!(self is MySqlDialect | GenericDialect)
1031110321 && self.parse_keyword(Keyword::PARTITION)
1031210322 {
@@ -10349,6 +10359,7 @@ impl<'a> Parser<'a> {
1034910359 version,
1035010360 partitions,
1035110361 with_ordinality,
10362+ partiql,
1035210363 };
1035310364
1035410365 while let Some(kw) = self.parse_one_of_keywords(&[Keyword::PIVOT, Keyword::UNPIVOT]) {
0 commit comments