MartijnVisser commented on code in PR #29815:
URL: https://github.com/apache/flink/pull/29815#discussion_r4525256387


##########
flink-runtime/src/main/java/org/apache/flink/runtime/state/v2/ttl/TtlListState.java:
##########
@@ -68,7 +68,11 @@ public StateFuture<StateIterator<T>> asyncGet() {
         // 1. The timestamp of elements in list state isn't updated when get 
even if updateTsOnRead
         // is true.
         // 2. we don't clear state here cause forst is LSM-tree based.
-        return original.asyncGet().thenApply(stateIter -> new 
AsyncIteratorWrapper(stateIter));
+        // 3. An empty state is returned as null, as the 
AppendingState#asyncGet contract requires.
+        return original.asyncGet()
+                .thenApply(
+                        stateIter ->
+                                stateIter == null ? null : new 
AsyncIteratorWrapper(stateIter));

Review Comment:
   With TTL, `toIterable` still throws `ClassCastException` once the list has 
data, since `AsyncIteratorWrapper` is not an `InternalStateIterator`. I filed 
that as FLINK-41416, so no need to fix it here.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to