[英]AWS Kinesis Analytics SQL to transform rows to a list
I have a Destination Stream
that looks as follows for example:我有一个目标
Stream
,例如如下所示:
Company_ID Product User_Tag Count
123 P1 T1 15
123 P1 T2 10
123 P1 T3 10
I want the Final Output as follows:我想要最终的 Output 如下:
Company_ID Product User_Tag Count
123 P1 [T1,T2,T3] 35
I tried using listagg
on User_Tag
but I get an error saying no function signature found
.我尝试在
User_Tag
上使用listagg
,但我收到一条错误消息,提示no function signature found
。 Is this even possible on AWS Kinesis SQL on streaming data?这在 AWS Kinesis SQL 流数据上是否可行?
SQL - Array Aggregate SQL - 数组聚合
SELECT company_id,
product,
Array_agg(user_tag),
Sum(count)
FROM stream
GROUP BY company_id,
product;
company_id | product | array_agg | sum
------------+---------+------------+-----
123 | P1 | {T1,T2,T3} | 35
SQL - String aggregate: SQL - 字符串聚合:
SELECT company_id,
product,
String_agg(user_tag, ','),
Sum(count)
FROM stream
GROUP BY company_id,
product;
company_id | product | string_agg | sum
------------+---------+------------+-----
123 | P1 | T1,T2,T3 | 35
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.