lukecwik commented on code in PR #22953:
URL: https://github.com/apache/beam/pull/22953#discussion_r1036500319


##########
sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/GroupIntoBatchesTest.java:
##########
@@ -709,4 +645,136 @@ public void processElement(ProcessContext c, 
BoundedWindow window) {
 
     pipeline.run().waitUntilFinish();
   }
+
+  @Test
+  @Category({
+    ValidatesRunner.class,
+    NeedsRunner.class,
+    UsesTimersInParDo.class,
+    UsesTestStream.class,
+    UsesStatefulParDo.class,
+    UsesOnWindowExpiration.class
+  })
+  public void 
testMultipleLimitsAtOnceInGlobalWindowBatchSizeCountAndBatchSizeByteSize() {
+    // with using only one of the limits the result would be only 2 batches,
+    // if we have 3 both limit works
+    List<KV<String, String>> dataToUse =
+        Lists.newArrayList(
+                "a-1",
+                "a-2",
+                "a-3" + Strings.repeat("-", 100),
+                // byte size limit reached (BATCH_SIZE_BYTES = 25)
+                "b-4",
+                "b-5",
+                "b-6",
+                "b-7",
+                "b-8",
+                // count limit reached (BATCH_SIZE = 5)
+                "c-9")
+            .stream()
+            .map(s -> KV.of("key", s))
+            .collect(Collectors.toList());
+
+    // to ensure ordered firing
+    TestStream.Builder<KV<String, String>> streamBuilder =
+        TestStream.create(KvCoder.of(StringUtf8Coder.of(), 
StringUtf8Coder.of()))
+            .advanceWatermarkTo(Instant.EPOCH);
+
+    long offset = 0L;
+    for (KV<String, String> kv : dataToUse) {

Review Comment:
   No, elements can be processed in parallel in any arbitrary order. timestamps 
are used with windowing which can hold/buffer inputs and produce outputs but 
that isn't the case with test stream.



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