You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-zh@flink.apache.org by 1048262223 <10...@qq.com> on 2020/06/04 10:12:17 UTC

回复:flink sql upsert模式写入mysql,es等key一定是groupby之后所有字段吗

Hi


非活动key的状态是可清理的,可参考
https://blog.csdn.net/lp284558195/article/details/104609739
https://ci.apache.org/projects/flink/flink-docs-stable/dev/table/streaming/query_configuration.html#:~:text=The%20minimum%20idle%20state%20retention,kept%20before%20it%20is%20removed.


Best,
Yichao Yang




------------------&nbsp;原始邮件&nbsp;------------------
发件人:&nbsp;"xu yihan"<mytardis@126.com&gt;;
发送时间:&nbsp;2020年6月4日(星期四) 下午5:59
收件人:&nbsp;"user-zh"<user-zh@flink.apache.org&gt;;

主题:&nbsp;flink sql upsert模式写入mysql,es等key一定是groupby之后所有字段吗




举个例子比如我想要
insert into mysql_sink
select 
&nbsp;&nbsp;&nbsp;&nbsp; ID,
&nbsp;&nbsp;&nbsp;&nbsp; amount, 
&nbsp;&nbsp;&nbsp;&nbsp; ………
&nbsp;from source
groupby ID;

这里就是想按照id为key,在数据库里更新这个id对应的amount等其他值。

但这样子不能通过calcite的sqlvalidation,select后面不能有非聚合项,必须在groupby后面加上所有select后面的项。
但这样带来一个问题,这样子key的state无限增长(比如说amount是一个随机的double数),job跑不久就会fail掉。

请问大家有什么办法能只指定部分字段为key来规避掉这个问题,谢谢。
之前发过一封类似的邮件,没有回复,只好再发一封,见谅。




发自我的iPhone