Qilong Wang created FLINK-41618:
-----------------------------------
Summary: Retractable Top-N misses updates after consecutive
retractions when the rank number is omitted
Key: FLINK-41618
URL: https://issues.apache.org/jira/browse/FLINK-41618
Project: Flink
Issue Type: Bug
Components: Table SQL / Planner
Affects Versions: 2.3.0
Reporter: Qilong Wang
A streaming ROW_NUMBER() Top-N can leave stale results when the selected range
starts after rank 1 and the rank number is omitted from the output.
AbstractTopNFunction.createOutputRow changes the RowKind of a row that the
operator also holds in state. A later retraction can then fail to match that
row.
Steps to reproduce
For a single partition, order by score ascending, keep ranks 2 and 3, and
project only id and score. Insert (id, score) values (1, 10), (2, 20), (3, 30),
(4, 40), (5, 50), then delete (1, 10) and (2, 20) in that order.
Expected: The visible IDs are [2, 3] after the inserts, [3, 4] after the first
deletion, and [4, 5] after the second. With UPDATE_BEFORE enabled, the operator
emits ten changelog records in total.
Actual: The first deletion updates the result to [3, 4]. The second deletion
emits no changes. Only six changelog records are produced. Reproduced in a
RetractableTopNFunction operator harness on Apache Flink master at b1f051d09c4.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)