[
https://issues.apache.org/jira/browse/CALCITE-5245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17597918#comment-17597918
]
Jia-Xuan Liu commented on CALCITE-5245:
---------------------------------------
Hi [~libenchao] ,
>>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?
BigQuery only supports ARRAY and STRUCT but STRUCT doesn't support the usage of
ITEM. It only supports the usage as below to access a field of a STRUCT.
{code:sql}
SELECT c1.f1 FROM
UNNEST([STRUCT<c1 STRUCT<f1 INT, f2 INT>, c2 INT>(STRUCT(1,2), 2),
(STRUCT(2,3), 3)]);
SELECT STRUCT<c1 INT, c2 INT>(1, 2).c1;
{code}
About MAP type, I didn't find any corresponding type for it in BigQuery.
>> 3. About ORDINAL, SAFE_ORDINAL, OFFSET, SAFE_OFFSET, IMHO, we could provide
>> configs for them
Sure. Do you have any suggestion about where to place those config?
>> 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.
Seems that we only need to distinguish ARRAY and STRUCT but I have no idea
about how to do this now. Maybe we should consdier [~julianhyde] suggestion to
solve them in RexNode level? I'm not really familiar with their source code. I
need sometime to trace and survery how to do.
Hi [~julianhyde]
Sure, I'll update the description soon.
> 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)