[jira] [Created] (FLINK-19196) FlinkSQL aggregation function to aggregate array typed column to Map/Multiset

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-19196) FlinkSQL aggregation function to aggregate array typed column to Map/Multiset

Shang Yuanchun (Jira)
sam lin created FLINK-19196:
-------------------------------

             Summary: FlinkSQL aggregation function to aggregate array typed column to Map/Multiset
                 Key: FLINK-19196
                 URL: https://issues.apache.org/jira/browse/FLINK-19196
             Project: Flink
          Issue Type: New Feature
          Components: Table SQL / API
    Affects Versions: 1.11.1
            Reporter: sam lin


Hi,
 
For FlinkSQL, how do I aggregate an array typed column to a Map/Multiset type? e.g. Given the source events:

userID, arr_types
1, [a, b]
2, [a]
1, [b, c]
 
```
SELECT userID, collect_arr(arr_types) FROM src_table GROUP BY userID
```

Using the above SQL could produce results like:
1, \{a: 1, b: 2, c:1}
2, \{a: 1}

My question is do we have existing UDF to do that?  If not, what is the recommended way to achieve this?  I'm happy to write a UDF if you could provide some code pointers.  Thanks in advance!



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