tmater opened a new pull request, #4844:
URL: https://github.com/apache/calcite/pull/4844

   ## Changes Proposed
   
   This PR adds opt-in support for `:` as a field/item access operator behind a 
new `SqlConformance#isColonFieldAccessAllowed()` hook. No built-in conformance 
enables it yet, so the default parser behavior is unchanged.
   
   It also refactors postfix parsing so colon field access composes with 
existing dot and bracket access. That covers cases such as `v:field`, 
`v:['field name']`, `arr[1]:field`, `obj['x']:nested['y']`, and colon access 
followed by bracket or dot postfixes.
   
   To avoid ambiguity when colon field access is enabled, `JSON_OBJECT` and 
`JSON_OBJECTAGG` must use `VALUE` syntax instead of `:` or comma-separated 
key/value shorthand.
   
   The Babel parser coverage is updated as well so PostgreSQL-style infix casts 
still require parentheses before bracket access. For example, `(v::variant)[1]` 
parses as item access on the cast result, while `v::variant[1]` remains invalid.
   
   ## Reproduction
   
   ```sql
   select v:field, v:['field name'], arr[1]:field, obj['x']:nested from t;
   
   select json_object(key v:field value arr[1]:field);
   
   select (v::variant)[1] from t;
   ```
   
   ## Testing
   
   Added parser coverage in `SqlParserTest` and `BabelParserTest` for valid and 
invalid colon field access, JSON constructor disambiguation, and `::` cast 
interactions.
   
   ## Jira Link
   [CALCITE-7448](https://issues.apache.org/jira/browse/CALCITE-7448)


-- 
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]

Reply via email to