tsreaper commented on a change in pull request #17570:
URL: https://github.com/apache/flink/pull/17570#discussion_r737077180



##########
File path: 
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/rank/RetractableTopNFunction.java
##########
@@ -455,9 +464,18 @@ private boolean retractRecordWithoutRowNumber(
                     // sends the record if there is a record recently upgrades 
to Top-N
                     int index = Long.valueOf(rankEnd - nextRank).intValue();
                     List<RowData> inputs = dataState.get(key);
-                    RowData toAdd = inputs.get(index);
-                    collectInsert(out, toAdd);
-                    break;
+                    if (inputs == null) {
+                        // Skip the data if it's state is cleared because of 
state ttl.
+                        if (lenient) {
+                            LOG.warn(STATE_CLEARED_WARN_MSG);
+                        } else {
+                            throw new RuntimeException(STATE_CLEARED_WARN_MSG);
+                        }
+                    } else {
+                        RowData toAdd = inputs.get(index);
+                        collectInsert(out, toAdd);
+                        break;

Review comment:
       `break` should be in the outer `else` block starting from line 463?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to