[
https://issues.apache.org/jira/browse/CALCITE-7448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18067692#comment-18067692
]
Tamas Mate commented on CALCITE-7448:
-------------------------------------
I’m currently working on a version that uses `SqlConformance` to make this
optional and disabled by default, so existing behavior stays unchanged unless a
conformance explicitly enables colon field access.
In the conformance that enables it, `:` is interpreted as field/item access, so
the ambiguous JSON colon shorthand would be disabled. In other words,
`JSON_OBJECT(k : v)` (and similarly `JSON_OBJECTAGG(k : v)`) would not be
accepted in that mode.
The explicit JSON form would still work, for example `JSON_OBJECT(KEY k VALUE
v)`, so JSON object construction remains available without ambiguity.
I also explored the alternative of trying to support both meanings of `:` in
the same parser configuration by disambiguating inside JSON constructors. That
seems possible in principle, but it made the expression grammar significantly
more invasive/stateful, so at the moment the conformance-based split seems like
the cleaner approach.
That said, I’m very open to feedback or other ideas if there is a better way to
draw the boundary here.
> Support colon-based field/item access syntax
> --------------------------------------------
>
> Key: CALCITE-7448
> URL: https://issues.apache.org/jira/browse/CALCITE-7448
> Project: Calcite
> Issue Type: New Feature
> Components: core
> Affects Versions: 1.41.0
> Reporter: Tamas Mate
> Priority: Major
> Labels: parser
>
> Implement support for colon field access syntax in the parser, for example:
> {code:java}
> v:field
> v:field.subfield
> v:['field name']
> arr[1]:field{code}
> Several systems (e.g. Snowflake, Databricks) support this kind of access, and
> with recent VARIANT support in Parquet it seems increasingly relevant for
> interoperability.
> One challenge is that ":" is already used in JSON constructor syntax, for
> example:
> {code:java}
> JSON_OBJECT('k': v)
> JSON_OBJECTAGG(k: v){code}
> The implementation needs to define how these cases interact, whether through
> disambiguation, dialect-specific behavior, or parser configuration.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)