rkhachatryan commented on a change in pull request #18391:
URL: https://github.com/apache/flink/pull/18391#discussion_r803954550



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/metadata/MetadataV2V3SerializerBase.java
##########
@@ -415,7 +440,7 @@ KeyedStateHandle deserializeKeyedStateHandle(
             int baseSize = dis.readInt();
             List<KeyedStateHandle> base = new ArrayList<>(baseSize);
             for (int i = 0; i < baseSize; i++) {
-                base.add(deserializeKeyedStateHandle(dis, context));
+                
base.add(Preconditions.checkNotNull(deserializeKeyedStateHandle(dis, context)));

Review comment:
       Maybe there is some misunderstanding, let me clarify what I mean:
   1. `NULL_HANDLE = 0` - there is already an explicit constant that encodes 
null handles
   2. I propose:
   ```
   for (int i = 0; i < baseSize; i++) {
       KeyedStateHandle handle = deserializeKeyedStateHandle(dis, context);
       if (handle != null) {
           base.add(handle);
       }
   }
   ```
   If you think throwing exception or logging here is more appropriate I'm also 
fine with this approach.
   




-- 
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