masteryhx commented on code in PR #23239:
URL: https://github.com/apache/flink/pull/23239#discussion_r1339585015


##########
flink-libraries/flink-state-processing-api/src/main/java/org/apache/flink/state/api/input/MultiStateKeyIterator.java:
##########
@@ -31,13 +31,17 @@
 import java.io.IOException;
 import java.util.Iterator;
 import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.stream.Stream;
 
 /**
  * An iterator for reading all keys in a state backend across multiple 
partitioned states.
  *
  * <p>To read unique keys across all partitioned states callers must invoke 
{@link
  * MultiStateKeyIterator#remove}.
  *
+ * <p>Note: Avoids using Stream#flatMap due to a known flaw, see FLINK-26585 
for more details.

Review Comment:
   nit: Move the comment to L53 ?



##########
flink-libraries/flink-state-processing-api/src/test/java/org/apache/flink/state/api/input/MultiStateKeyIteratorTest.java:
##########
@@ -125,4 +226,117 @@ public void testIteratorRemovesFromAllDescriptors() 
throws Exception {
                             .count());
         }
     }
+
+    /** Test for lazy enumeration of inner iterators. */
+    @Test
+    public void testIteratorPullsSingleKeyFromAllDescriptors() throws 
AssertionError {
+        CountingKeysKeyedStateBackend keyedStateBackend =
+                createCountingKeysKeyedStateBackend(100_000_000);
+        MultiStateKeyIterator<Integer> testedIterator =
+                new MultiStateKeyIterator<>(descriptors, keyedStateBackend);
+
+        boolean hasnext = testedIterator.hasNext();

Review Comment:
   ```suggestion
           testedIterator.hasNext();
   ```



##########
flink-libraries/flink-state-processing-api/src/test/java/org/apache/flink/state/api/input/MultiStateKeyIteratorTest.java:
##########
@@ -125,4 +226,117 @@ public void testIteratorRemovesFromAllDescriptors() 
throws Exception {
                             .count());
         }
     }
+
+    /** Test for lazy enumeration of inner iterators. */
+    @Test
+    public void testIteratorPullsSingleKeyFromAllDescriptors() throws 
AssertionError {

Review Comment:
   Okay, Thanks for the clarification.



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