You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Tanner Clary (Jira)" <ji...@apache.org> on 2024/02/08 16:15:00 UTC

[jira] [Commented] (CALCITE-6255) Support BigQuery-style JSON_OBJECT invocation syntax

    [ https://issues.apache.org/jira/browse/CALCITE-6255?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17815745#comment-17815745 ] 

Tanner Clary commented on CALCITE-6255:
---------------------------------------

Is this case concerned with making sure we generate BQ-friendly SQL as well (assuming the target is BQ)? Or is it solely focused on making sure Calcite can parse BQ SQL?

> Support BigQuery-style JSON_OBJECT invocation syntax
> ----------------------------------------------------
>
>                 Key: CALCITE-6255
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6255
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.36.0
>            Reporter: Barry Kelly
>            Priority: Minor
>              Labels: parser
>
> Currently, Calcite has two styles for invoking JSON_OBJECT:
> {{    JSON_OBJECT(KEY 'foo' VALUE 'bar', KEY 'foo2' VALUE 'bar2')}}
> and:
> {{    JSON_OBJECT('foo' : 'bar', 'foo2' : 'bar')}}
> However, [BigQuery|https://cloud.google.com/bigquery/docs/reference/standard-sql/json_functions#json_object] uses a lighter-weight syntax resembling the MAP<> constructor, with an even numbered argument list where every odd item is a key and the following even item is a value:
> {{    JSON_OBJECT('foo', 'bar', 'foo2', 'bar2')}}
> With the objective of syntax compatibility with BigQuery, the simplest change to the grammar is to allow ',' as well as ':' for separating key/value pairs in the invocation.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)