This is an automated email from the ASF dual-hosted git repository.

thw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apex-malhar.git


The following commit(s) were added to refs/heads/master by this push:
     new ed3e6ff  APEXMALHAR-2534 Provided fix for TopNWordsWithQueries example.
ed3e6ff is described below

commit ed3e6ffda95364f04aa1b7fc6b9f0bc706bad9f9
Author: Lakshmi Prasanna Velineni <[email protected]>
AuthorDate: Tue Aug 1 11:26:58 2017 -0700

    APEXMALHAR-2534 Provided fix for TopNWordsWithQueries example.
---
 .../org/apache/apex/examples/wordcount/LineReader.java  | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git 
a/examples/wordcount/src/main/java/org/apache/apex/examples/wordcount/LineReader.java
 
b/examples/wordcount/src/main/java/org/apache/apex/examples/wordcount/LineReader.java
index 25336ae..ca25fb8 100644
--- 
a/examples/wordcount/src/main/java/org/apache/apex/examples/wordcount/LineReader.java
+++ 
b/examples/wordcount/src/main/java/org/apache/apex/examples/wordcount/LineReader.java
@@ -41,6 +41,7 @@ import com.datatorrent.lib.io.fs.AbstractFileInputOperator;
 public class LineReader extends AbstractFileInputOperator<String>
 {
   private static final Logger LOG = LoggerFactory.getLogger(LineReader.class);
+  private boolean flag = true;
 
   /**
    * Output port on which lines from current file name are emitted
@@ -104,6 +105,7 @@ public class LineReader extends 
AbstractFileInputOperator<String>
     if (control.isConnected()) {
       LOG.info("readEntity: EOF for {}", path);
       final String name = path.getName();    // final component of path
+      flag = false;
       control.emit(name);
     }
 
@@ -111,8 +113,23 @@ public class LineReader extends 
AbstractFileInputOperator<String>
   }
 
   @Override
+  public void emitTuples()
+  {
+    if (flag) {
+      super.emitTuples();
+    }
+  }
+
+  @Override
   protected void emit(String tuple)
   {
     output.emit(tuple);
   }
+
+  @Override
+  public void endWindow()
+  {
+    super.endWindow();
+    flag = true;
+  }
 }

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to