You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2021/03/10 22:57:28 UTC

[GitHub] [beam] y1chi commented on a change in pull request #14182: [BEAM-11952] Clean up merged window result in MergingViaWindowFnRunne…

y1chi commented on a change in pull request #14182:
URL: https://github.com/apache/beam/pull/14182#discussion_r591933447



##########
File path: sdks/java/harness/src/main/java/org/apache/beam/fn/harness/WindowMergingFnRunner.java
##########
@@ -151,10 +151,12 @@ public void merge(Collection<W> toBeMerged, W mergeResult) throws Exception {
         KV<T, Iterable<W>> windowsToMerge) throws Exception {
       currentWindows = Sets.newHashSet(windowsToMerge.getValue());
       windowFn.mergeWindows((MergeContext) mergeContext);
+      ArrayList mergedWindowsCopy = new ArrayList<>(mergedWindows);
       for (KV<W, Collection<W>> mergedWindow : mergedWindows) {
         currentWindows.removeAll(mergedWindow.getValue());
       }
-      return KV.of(windowsToMerge.getKey(), KV.of(currentWindows, (Iterable) mergedWindows));
+      mergedWindows.clear();

Review comment:
       It definitely can be considered wrong, since the previous merge result could have been processed by runner and the related windows could have been cleaned up. Added in unit test.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org