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

silence commented on FLINK-18590:
---------------------------------

Can we do this in the form of computed columns like this:

CREATE TABLE source (
 message as rowToColumn(), -- type:String,value:[\{"col1": 1, "col2": 
"hello"},\{"col1": 2, "col2": "flink"}]
 messageAsString as rowToColumn(String), -- type:String,value:[\{"col1": 1, 
"col2": "hello"},\{"col1": 2, "col2": "flink"}]
 messageAsArray as rowToColumn(Array<Row<col1 Int,col2 String>>) -- 
type:Array<Row<col1 Int,col2 String>>,value:[\{"col1": 1, "col2": 
"hello"},\{"col1": 2, "col2": "flink"}]
) WITH (
 ...
 'format' = 'json'
)

rowToColumn([SpecificType]) is a function, it can convert an entire row of 
records into a column with specific type,Then we can analyze it flexibly in SQL 
through JSON UDF

> Support json array explode to multi messages
> --------------------------------------------
>
>                 Key: FLINK-18590
>                 URL: https://issues.apache.org/jira/browse/FLINK-18590
>             Project: Flink
>          Issue Type: Improvement
>          Components: Formats (JSON, Avro, Parquet, ORC, SequenceFile)
>            Reporter: Benchao Li
>            Assignee: Benchao Li
>            Priority: Major
>              Labels: pull-request-available
>
> Currently our {{DeserializationSchema}} has supported to emit multi messages 
> for one input record. There is some cases that the json data is not a json 
> object in top level, for example:
> {code:SQL}
> CREATE TABLE source (
>   col1 int,
>   col2 varchar
> ) WITH (
>   ...
>   'format' = 'json'
> )
> {code}
> With following data.
> {code:json}
> [
> {"col1": 1, "col2": "hello"},
> {"col1": 2, "col2": "flink"}
> ]
> {code}
> CC [~jark]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to