[ https://issues.apache.org/jira/browse/FLINK-24412?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
lincoln lee closed FLINK-24412. ------------------------------- Fix Version/s: 1.16.0 Resolution: Fixed > retract stream join on topN error > -------------------------------------- > > Key: FLINK-24412 > URL: https://issues.apache.org/jira/browse/FLINK-24412 > Project: Flink > Issue Type: Bug > Components: Table SQL / Runtime > Affects Versions: 1.12.3 > Reporter: sandy du > Priority: Critical > Fix For: 1.16.0 > > > I can reappear this error in follow sql: > create table user_info( > name string, > age int, > primary key(name) not enforced > ) whith( > 'connector'='jdbc', > 'url'='jdbc:mysql...', > ... > 'lookup.cache.max-rows'='0', > 'lookup.cache.ttl'='1 s' > ); > create table user_action( > name string, > app string, > dt string, > proctime as proctime() > )whith( > 'connector'='kafka', > ... > ); > create view v_user_action as select * from( > select name,app,proctime,row_number() over(partition by name,app order by dt > desc) as rn from user_action > )t where rn=1; > create view user_out as select a.name,a.app,b.age from v_user_action a left > join user_info > for system_time as of a.proctime as b on a.name=b.name; > select * from ( > select name,app,age ,row_number() over(partition by name,app order by age > desc) as rn from user_out > ) t where rn=1; > > *first :* > {color:#de350b} user_action got data > \{"name":"11","app":"app","dt":"2021-09-10"}{color} > {color:#de350b}user_info got data \{"name":"11","age":11}{color} > at the moment sql can successful run. > *{color:#de350b}then :{color}* > {color:#de350b}user_action got data > \{"name":"11","app":"app","dt":"2021-09-20"}{color} > {color:#de350b}user_info got data \{"name":"11","age":11} > \{"name":"11","age":22} {color} > now, TopN query on last sql, the TopN operator will thrown exception: > {{Caused by: java.lang.RuntimeException: Can not retract a non-existent > record. This should never happen.}} -- This message was sent by Atlassian Jira (v8.20.10#820010)