[ https://issues.apache.org/jira/browse/FLINK-35037?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
yisha zhou updated FLINK-35037: ------------------------------- Description: In current Implementation, relNodes with Window type will only deliver upsert/unique keys of their inputs. However windows with ROW_NUMBER can also produce upsert/unique keys. For example: {code:java} select id, name, score, age, class, row_number() over(partition by class order by name) as rn, rank() over (partition by class order by score) as rk, dense_rank() over (partition by class order by score) as drk, avg(score) over (partition by class order by score) as avg_score, max(score) over (partition by age) as max_score, count(id) over (partition by age) as cnt from student {code} (class, rn) is a valid uniqueKeys/upsertKeys candidate. was: In current Implementation, relNodes with Window type will only deliver upsert/unique keys of their inputs if these keys contains the partition keys. However windows with ROW_NUMBER can also produce upsert/unique keys. For example: {code:java} select id, name, score, age, class, row_number() over(partition by class order by name) as rn, rank() over (partition by class order by score) as rk, dense_rank() over (partition by class order by score) as drk, avg(score) over (partition by class order by score) as avg_score, max(score) over (partition by age) as max_score, count(id) over (partition by age) as cnt from student {code} (class, rn) is a valid uniqueKeys candidate. > Optimize uniqueKeys and upsertKeys inference of windows with ROW_NUMBER > ----------------------------------------------------------------------- > > Key: FLINK-35037 > URL: https://issues.apache.org/jira/browse/FLINK-35037 > Project: Flink > Issue Type: Improvement > Components: Table SQL / Planner > Affects Versions: 1.20.0 > Reporter: yisha zhou > Priority: Major > > In current Implementation, relNodes with Window type will only deliver > upsert/unique keys of their inputs. > However windows with ROW_NUMBER can also produce upsert/unique keys. > For example: > {code:java} > select id, name, score, age, class, > row_number() over(partition by class order by name) as rn, > rank() over (partition by class order by score) as rk, > dense_rank() over (partition by class order by score) as drk, > avg(score) over (partition by class order by score) as avg_score, > max(score) over (partition by age) as max_score, > count(id) over (partition by age) as cnt > from student {code} > (class, rn) is a valid uniqueKeys/upsertKeys candidate. -- This message was sent by Atlassian Jira (v8.20.10#820010)