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

Jia-Xuan Liu commented on CALCITE-5245:
---------------------------------------

[~julianhyde] I've updated the description. I'm not sure whether it is clear to 
present what this issue want to solve. IMO, Calcite can be a JDBC adapter to 
access BigQuery. In my case, I input a SQL follow the Calcite syntax, then it 
can print a valid BigQuery SQL by SqlPrettyWriter with BigQueryDialect.

[~libenchao] Thanks for the suggestion. I'll try to follow this idea to 
modified the PR.

> Array element accessing in BigQuery should invoke `ORDINAL` operator
> --------------------------------------------------------------------
>
>                 Key: CALCITE-5245
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5245
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.31.0
>            Reporter: Jia-Xuan Liu
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Access an element of array in BigQuery should invoke `ORDINAL`(1-based) or 
> `OFFSET`(0-based) operator for the index. See [BigQuery Accessing array 
> elements|https://cloud.google.com/bigquery/docs/reference/standard-sql/arrays#accessing_array_elements].
> For example:
> {code:sql}
> SELECT ARRAY[1,2,3][ORDINAL(1)]
> {code}
> In Calcite, we access an array element using a common way like 
> `array_expr[1]`. When we try to convert a Calcite SQL to a BigQuery SQL, 
> BigQuerySqlDialect should use the BigQuery [array subscript 
> operator|https://cloud.google.com/bigquery/docs/reference/standard-sql/operators#array_subscript_operator]
>  to handle the index. Otherwise, when convert a RelNode to SqlNode with 
> BigQuerySqlDialect, the RelToSqlConverter won't generate a correct SqlNode 
> for BigQuery.



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

Reply via email to