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 DovEゞ <24...@qq.com> on 2020/11/16 06:27:05 UTC

changlog-json的去重方法

Hi,各位下午好
开发中出现一种场景:
获取某一个人当天最早到店的记录
平常SQL写法是:
select memberid, shop_time, workerid, resource_type, proctime
from(
&nbsp; &nbsp; select memberid, shop_time, workerid, resource_type, proctime
&nbsp; &nbsp; from inviteShop
&nbsp; &nbsp;&nbsp;where shop_time &gt;= DATE_FORMAT(LOCALTIMESTAMP, 'yyyy-MM-dd')
) t0
inner join
(
&nbsp; &nbsp; select memberid, min(shop_time) as shop_time
&nbsp; &nbsp; from inviteShop
&nbsp; &nbsp; where shop_time &gt;= DATE_FORMAT(LOCALTIMESTAMP, 'yyyy-MM-dd')
&nbsp; &nbsp; group by memberid
) t1 on t0.memberid = t1.memberid and t0.shop_time = t1.shop_time&nbsp;



有查阅到官方文档中提供的去重方法,但是目前inviteShop建的是Kafka表,Changelog-json格式。从报错上看好像是不支持这种格式,想问下有没有其他方法解决?
Best
SELECT [column_list] FROM (    SELECT [column_list],      ROW_NUMBER() OVER ([PARTITION BY col1[, col2...]]        ORDER BY time_attr [asc|desc]) AS rownum    FROM table_name) WHERE rownum = 1org.apache.flink.table.api.TableException: Deduplicate doesn't support consuming update and delete changes which is produced by node TableSourceScan