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

Benchao Li commented on CALCITE-5245:
-------------------------------------

[~goldmedal] Thanks for the PR, maybe we need to clarify several things before 
we go to the code details. Since Calcite's {{ITEM}} operator's first operand 
could be {{MAP}}, {{ARRAY}}, {{STRUCT}}, could you help explain that:

1. Does BigQuery support all these types? If some of them are not supported, 
maybe we should validate and throw exception in {{RelToSqlConverter}}
2. Do these types in BigQuery all support {{ITEM}} operator, if not, are there 
any other alternatives?
3. About {{ORDINAL}}, {{SAFE_ORDINAL}}, {{OFFSET}}, {{SAFE_OFFSET}}, IMHO, we 
could provide configs for them
4. After #1 and #2 have been clarified, if we still need to distinguish the 
operand's type in {{BigQuerySqlDialect#unparseCall}}, I would say that I don't 
know how to do this for now, I would like to hear others' opinions for this.

> 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