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

Julian Hyde commented on CALCITE-5245:
--------------------------------------

[~goldmedal], Can you make clear in the summary / description that you are 
talking about generating SQL, i.e. the JDBC adapter. I initially thought you 
were proposing support for ORDINAL and OFFSET in the parser (which would also 
be a valid request).

I agree with [~libenchao] that this might be better solved at the RexNode 
level, where type information is present. Calcite's ITEM operator complies with 
ISO standard SQL, so one idea is to add two BigQuery-specific functions, 
ARRAY_ITEM_BASE_0 and ARRAY_ITEM_BASE_1, which generate OFFSET and ORDINAL 
respectively. You would need to transform ITEM to ARRAY_ITEM_BASE_1 in 
RelToSqlConverter.

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



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

Reply via email to