Github user StefanRRichter commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3531#discussion_r107870871
  
    --- Diff: 
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/StateAssignmentOperation.java
 ---
    @@ -290,19 +291,19 @@ private static void 
assignTaskStatesToOperatorInstances(
         * <p>
         * <p>This is publicly visible to be used in tests.
         */
    -   public static List<KeyGroupsStateHandle> getKeyGroupsStateHandles(
    -                   Collection<KeyGroupsStateHandle> allKeyGroupsHandles,
    -                   KeyGroupRange subtaskKeyGroupIds) {
    +   public static List<KeyedStateHandle> getKeyedStateHandles(
    +                   Collection<? extends KeyedStateHandle> 
keyedStateHandles,
    +                   KeyGroupRange subtaskKeyGroupRange) {
     
    -           List<KeyGroupsStateHandle> subtaskKeyGroupStates = new 
ArrayList<>();
    +           List<KeyedStateHandle> subtaskKeyedStateHandles = new 
ArrayList<>();
     
    -           for (KeyGroupsStateHandle storedKeyGroup : allKeyGroupsHandles) 
{
    -                   KeyGroupsStateHandle intersection = 
storedKeyGroup.getKeyGroupIntersection(subtaskKeyGroupIds);
    -                   if (intersection.getNumberOfKeyGroups() > 0) {
    -                           subtaskKeyGroupStates.add(intersection);
    -                   }
    +           for (KeyedStateHandle keyedStateHandle : keyedStateHandles) {
    +                   KeyedStateHandle intersectedKeyedStateHandle = 
keyedStateHandle.getIntersection(subtaskKeyGroupRange);
    +
    +                   
subtaskKeyedStateHandles.add(intersectedKeyedStateHandle);
    --- End diff --
    
    I think we should only add a state handle if the key group range from the 
intersection is non-empty. Even though those empty handles are probably ignored 
later, I think it is cleaner.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to