nevillelyh commented on a change in pull request #4175: [BEAM-3247] fix 
Sample.any performance
URL: https://github.com/apache/beam/pull/4175#discussion_r153343674
 
 

 ##########
 File path: 
sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Sample.java
 ##########
 @@ -209,29 +202,67 @@ public void populateDisplayData(DisplayData.Builder 
builder) {
   }
 
   /**
-   * A {@link DoFn} that returns up to limit elements from the side input 
PCollection.
+   * A {@link DoFn} that outputs up to limit elements.
    */
-  private static class SampleAnyDoFn<T> extends DoFn<Void, T> {
-    long limit;
-    final PCollectionView<Iterable<T>> iterableView;
+  private static class SampleAnyDoFn<T> extends DoFn<T, T> {
 
 Review comment:
   There's no combine in the current implementation though. It looks like this:
   
   ```java
       @Override
       public PCollection<T> expand(PCollection<T> in) {
         PCollectionView<Iterable<T>> iterableView = 
in.apply(View.<T>asIterable());
         return in.getPipeline()
             .apply(Create.of((Void) null).withCoder(VoidCoder.of()))
             .apply(ParDo.of(new SampleAnyDoFn<>(limit, 
iterableView)).withSideInputs(iterableView))
             .setCoder(in.getCoder());
       }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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