@@ -2920,7 +2920,7 @@ impl<'a> Parser<'a> {
2920
2920
} else if Token::LBracket == tok {
2921
2921
if dialect_of!(self is PostgreSqlDialect | DuckDbDialect | GenericDialect) {
2922
2922
self.parse_subscript(expr)
2923
- } else if dialect_of!(self is SnowflakeDialect) {
2923
+ } else if dialect_of!(self is SnowflakeDialect) || self.dialect.supports_partiql() {
2924
2924
self.prev_token();
2925
2925
self.parse_json_access(expr)
2926
2926
} else {
@@ -3056,6 +3056,14 @@ impl<'a> Parser<'a> {
3056
3056
}
3057
3057
3058
3058
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> {
3059
3067
let mut path = Vec::new();
3060
3068
loop {
3061
3069
match self.next_token().token {
@@ -3079,10 +3087,7 @@ impl<'a> Parser<'a> {
3079
3087
}
3080
3088
3081
3089
debug_assert!(!path.is_empty());
3082
- Ok(Expr::JsonAccess {
3083
- value: Box::new(expr),
3084
- path: JsonPath { path },
3085
- })
3090
+ Ok(JsonPath{ path })
3086
3091
}
3087
3092
3088
3093
pub fn parse_map_access(&mut self, expr: Expr) -> Result<Expr, ParserError> {
@@ -10306,7 +10311,12 @@ impl<'a> Parser<'a> {
10306
10311
self.parse_open_json_table_factor()
10307
10312
} else {
10308
10313
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
+
10310
10320
let partitions: Vec<Ident> = if dialect_of!(self is MySqlDialect | GenericDialect)
10311
10321
&& self.parse_keyword(Keyword::PARTITION)
10312
10322
{
@@ -10349,6 +10359,7 @@ impl<'a> Parser<'a> {
10349
10359
version,
10350
10360
partitions,
10351
10361
with_ordinality,
10362
+ partiql,
10352
10363
};
10353
10364
10354
10365
while let Some(kw) = self.parse_one_of_keywords(&[Keyword::PIVOT, Keyword::UNPIVOT]) {
0 commit comments