goldmedal commented on PR #1541:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/1541#issuecomment-2490464568
We should refactor to integrate `Subscript` and `MapAccessSyntax::Bracket`,
as they are similar and difficult to distinguish at the SQL layer.
For example, DuckDB allows the following SQL, which is currently invalid in
our parser:
```sql
select [MAP {2:{a:1, b:[2,3,4]}}, MAP {2:{a:1, b:[2,3,4]}}][1][2][1].b[1:2]
as result;
┌─────────┐
│ result │
│ int32[] │
├─────────┤
│ [2, 3] │
└─────────┘
```
The access pattern `[1][2][1].b[1:2]` includes both `Subscript` and
`MapAccess`. We cannot parse all these as a `MapAccessKey` following the `.`
token.
https://github.com/apache/datafusion-sqlparser-rs/blob/fad2ddd6417e2e4d149c298d1977088124a30358/src/ast/mod.rs#L805-L808
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]