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

Feng Jin commented on FLINK-34898:
----------------------------------

I tried this case and indeed encountered an error, but I managed to pass the 
test by trying a different approach.

 

 
{code:java}
//代码占位符


-- The query is normal and results can be obtained.
Flink SQL> SELECT cast(ARRAY[ROW(1)] as ARRAY<ROW<a INT>>);
[INFO] Result retrieval cancelled.


-- Got the exception

Flink SQL> SELECT ARRAY[cast(ROW(1) as ROW<a INT>)];
[ERROR] Could not execute SQL statement. Reason:
java.lang.UnsupportedOperationException: class 
org.apache.calcite.sql.SqlBasicCall: ROW(1)
 {code}
 

 

I think this might indeed be a bug, we need to follow up and fix it.

 

[~chloehe]  Can you help me modify the title and content of Jira?  Please 
provide the specific query and corresponding error message.

 

 

> Cannot create named STRUCT with a single field
> ----------------------------------------------
>
>                 Key: FLINK-34898
>                 URL: https://issues.apache.org/jira/browse/FLINK-34898
>             Project: Flink
>          Issue Type: Bug
>            Reporter: Chloe He
>            Priority: Major
>         Attachments: image-2024-03-21-12-00-00-183.png
>
>
> I'm trying to create named structs using Flink SQL and I found a previous 
> ticket https://issues.apache.org/jira/browse/FLINK-9161 that mentions the use 
> of the following syntax:
> {code:java}
> SELECT CAST(('a', 1) as ROW<a STRING, b INT>) AS row1;
> {code}
> However, my named struct has a single field and effectively it should look 
> something like `\{"a": 1}`. I can't seem to be able to find a way to 
> construct this. I have experimented with a few different syntax and it either 
> throws parsing error or casting error:
> {code:java}
> Cast function cannot convert value of type INTEGER to type 
> RecordType(VARCHAR(2147483647) a) {code}



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

Reply via email to