You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by si...@apache.org on 2018/11/28 06:47:28 UTC
[pulsar] branch master updated: Fixed wordcount example to actually
extract words from sentence (#3075)
This is an automated email from the ASF dual-hosted git repository.
sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 35f84eb Fixed wordcount example to actually extract words from sentence (#3075)
35f84eb is described below
commit 35f84ebe81f0e4fb0dd5cb28500c257b42ef9d86
Author: Sanjeev Kulkarni <sa...@gmail.com>
AuthorDate: Tue Nov 27 22:47:23 2018 -0800
Fixed wordcount example to actually extract words from sentence (#3075)
---
.../org/apache/pulsar/functions/api/examples/WordCountFunction.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pulsar-functions/java-examples/src/main/java/org/apache/pulsar/functions/api/examples/WordCountFunction.java b/pulsar-functions/java-examples/src/main/java/org/apache/pulsar/functions/api/examples/WordCountFunction.java
index d9e6747..63aabd7 100644
--- a/pulsar-functions/java-examples/src/main/java/org/apache/pulsar/functions/api/examples/WordCountFunction.java
+++ b/pulsar-functions/java-examples/src/main/java/org/apache/pulsar/functions/api/examples/WordCountFunction.java
@@ -31,8 +31,8 @@ import java.util.Arrays;
*/
public class WordCountFunction implements Function<String, Void> {
@Override
- public Void process(String input, Context context) throws Exception {
- Arrays.asList(input.split("\\.")).forEach(word -> context.incrCounter(word, 1));
+ public Void process(String input, Context context) {
+ Arrays.asList(input.split("\\s+")).forEach(word -> context.incrCounter(word, 1));
return null;
}
}