[
https://issues.apache.org/jira/browse/CALCITE-4999?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17490793#comment-17490793
]
Dmitry Sysolyatin commented on CALCITE-4999:
--------------------------------------------
I tried to read some standards from this page
[https://www.postgresql.org/docs/14/features.html] . But it turned out that it
costs money :) [https://www.iso.org/standard/67382.html]
But BigQuery
[https://cloud.google.com/bigquery/docs/reference/standard-sql/subqueries]
documentation has also the following lines:
{code:java}
The SELECT list in an ARRAY subquery must have exactly one column of any type,
which defines the element type of the array returned by the array subquery{code}
I think the best solution will be split this task to tasks:
# Fix current `ARRAY` implementation in order it return `scalar array` type in
case of subquery (At least BigQuery and PG `array` implementation work like
this)
# Extend `ARRAY` implementation for {{SELECT AS STRUCT}} and SELECT AS VALUE
(If someone really needs it)
> `least restrictive` type inference does not work when one operand is scalar
> and another is row with one field
> -------------------------------------------------------------------------------------------------------------
>
> Key: CALCITE-4999
> URL: https://issues.apache.org/jira/browse/CALCITE-4999
> Project: Calcite
> Issue Type: Bug
> Components: core
> Reporter: Dmitry Sysolyatin
> Assignee: Dmitry Sysolyatin
> Priority: Major
> Labels: pull-request-available
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> I faced with a issue that the following query:
> {code:java}
> SELECT ARRAY_CONCAT(ARRAY['1', '2'], array(select 'toast.' || x from
> unnest(ARRAY['1','2']) x)) {code}
> didn't work, because of:
> {code:java}
> java.lang.IllegalArgumentException: Cannot infer return type for
> ARRAY_CONCAT; operand types: [CHAR(1) ARRAY, RecordType(CHAR(7) EXPR$0)
> ARRAY]{code}
> `least restrictive` type inference does not work when one operand is scalar
> and another is row with one field
--
This message was sent by Atlassian Jira
(v8.20.1#820001)