johnyangk closed pull request #120: [NEMO-217] Immediately emits elements in 
FlattenTransform
URL: https://github.com/apache/incubator-nemo/pull/120
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/compiler/frontend/beam/src/main/java/org/apache/nemo/compiler/frontend/beam/transform/FlattenTransform.java
 
b/compiler/frontend/beam/src/main/java/org/apache/nemo/compiler/frontend/beam/transform/FlattenTransform.java
index dd23c9b43..2dd0e61da 100644
--- 
a/compiler/frontend/beam/src/main/java/org/apache/nemo/compiler/frontend/beam/transform/FlattenTransform.java
+++ 
b/compiler/frontend/beam/src/main/java/org/apache/nemo/compiler/frontend/beam/transform/FlattenTransform.java
@@ -18,21 +18,17 @@
 import org.apache.nemo.common.ir.OutputCollector;
 import org.apache.nemo.common.ir.vertex.transform.Transform;
 
-import java.util.ArrayList;
-
 /**
  * Flatten transform implementation.
  * @param <T> input/output type.
  */
 public final class FlattenTransform<T> implements Transform<T, T> {
-  private final ArrayList<T> collectedElements;
   private OutputCollector<T> outputCollector;
 
   /**
    * FlattenTransform Constructor.
    */
   public FlattenTransform() {
-    this.collectedElements = new ArrayList<>();
   }
 
   @Override
@@ -42,13 +38,11 @@ public void prepare(final Context context, final 
OutputCollector<T> oc) {
 
   @Override
   public void onData(final T element) {
-    collectedElements.add(element);
+    outputCollector.emit(element);
   }
 
   @Override
   public void close() {
-    collectedElements.forEach(outputCollector::emit);
-    collectedElements.clear();
   }
 
   @Override


 

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