You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Chloe He (Jira)" <ji...@apache.org> on 2024/03/21 17:01:00 UTC

[jira] [Commented] (FLINK-34898) Cannot create ARRAY of named STRUCTs

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

Chloe He commented on FLINK-34898:
----------------------------------

[~hackergin] I have updated the title and the content of this ticket. Thank you!

> Cannot create ARRAY of named STRUCTs
> ------------------------------------
>
>                 Key: FLINK-34898
>                 URL: https://issues.apache.org/jira/browse/FLINK-34898
>             Project: Flink
>          Issue Type: Bug
>    Affects Versions: 1.19.0
>            Reporter: Chloe He
>            Priority: Major
>         Attachments: image-2024-03-21-12-00-00-183.png
>
>
> I want to construct data that consists of arrays of named STRUCT. For example, one field may look like `[\{"a": 1}]`. I am able to construct this named STRUCT as
> {code:java}
> SELECT CAST(ROW(1) as ROW<a INT>) AS row1;  {code}
> but when I try to wrap this in an ARRAY, it fails:
> {code:java}
> SELECT ARRAY[CAST(ROW(1) as ROW<a INT>)] AS row1;  
> // error
> Caused by: java.lang.UnsupportedOperationException: class org.apache.calcite.sql.SqlBasicCall: ROW(1)
> {code}
> These are the workarounds that I found:
> {code:java}
> SELECT ROW(ROW(CAST(ROW(1) as ROW<a INT>))) AS row1; 
> // or
> SELECT cast(ARRAY[ROW(1)] as ARRAY<ROW<a INT>>); {code}
> but I think this is a bug that we need to follow up and fix.



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