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 01:55:00 UTC

[jira] [Created] (FLINK-34898) Cannot create named STRUCT with a single field

Chloe He created FLINK-34898:
--------------------------------

             Summary: 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


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:

```sql

SELECT CAST(('a', 1) as ROW<a STRING, b INT>) AS row1;

```

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:

```

Cast function cannot convert value of type INTEGER to type RecordType(VARCHAR(2147483647) a)

```



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