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

Julian Hyde commented on CALCITE-4999:
--------------------------------------

I am much more inclined to believe that the problem is with the type derivation 
of {{ARRAY (sub-query)}}.

If we change that, we should also change the type derivation for {{MULTISET 
(sub-query)}}.

Do you know what the SQL standard says should be the type of {{ARRAY}} applied 
to a sub-query of with 1 column?

What about other databases? Google BigQuery might be interesting, because it 
has {{SELECT AS STRUCT}} and {{SELECT AS VALUE}} to control how single- and 
multi-column sub-queries return results.

> `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)

Reply via email to