lukecwik commented on a change in pull request #11122: [BEAM-9346] Improve the 
efficiency of TFRecordIO
URL: https://github.com/apache/beam/pull/11122#discussion_r395414286
 
 

 ##########
 File path: sdks/java/core/src/main/java/org/apache/beam/sdk/io/WriteFiles.java
 ##########
 @@ -410,13 +412,44 @@ private GatherResults(Coder<ResultT> resultCoder) {
       } else {
         // Pass results via a side input rather than reshuffle, because we 
need to get an empty
         // iterable to finalize if there are no results.
-        return input
-            .getPipeline()
-            .apply(Reify.viewInGlobalWindow(input.apply(View.asList()), 
ListCoder.of(resultCoder)));
+        return input.apply("ToList", Combine.globally(new 
ToListCombineFn<>()));
 
 Review comment:
   I believe this could be a regression based upon the above comment a few 
lines higher then where the code was changed:
   ```
   // Pass results via a side input rather than reshuffle, because we need to 
get an empty
   // iterable to finalize if there are no results.
   ```
   The combine globally in the global window will produce a default output in 
the global window but will throw an exception if used against non-global window 
PCollections.
   
   Performance wise this is likely an improvement overall since runners 
typically do a better job with GBK then with side inputs. So we could keep this 
change as an optimization in the global window case and keep the existing 
behavior for non global windows.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to