beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dhalp...@apache.org
Subject [01/19] incubator-beam git commit: Port WordCount example from OldDoFn to DoFn
Date Thu, 04 Aug 2016 01:26:09 GMT
Repository: incubator-beam
Updated Branches:
  refs/heads/master 388816a80 -> 9a329aada


Port WordCount example from OldDoFn to DoFn


Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/64481d0c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/64481d0c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/64481d0c

Branch: refs/heads/master
Commit: 64481d0c2ed52a075ca1f0aa9946155aa9b13119
Parents: 3bcb6f4
Author: Kenneth Knowles <klk@google.com>
Authored: Fri Jul 22 14:28:28 2016 -0700
Committer: Dan Halperin <dhalperi@google.com>
Committed: Wed Aug 3 18:25:52 2016 -0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/beam/examples/WordCount.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/64481d0c/examples/java/src/main/java/org/apache/beam/examples/WordCount.java
----------------------------------------------------------------------
diff --git a/examples/java/src/main/java/org/apache/beam/examples/WordCount.java b/examples/java/src/main/java/org/apache/beam/examples/WordCount.java
index 274d1ad..d3768a8 100644
--- a/examples/java/src/main/java/org/apache/beam/examples/WordCount.java
+++ b/examples/java/src/main/java/org/apache/beam/examples/WordCount.java
@@ -26,8 +26,8 @@ import org.apache.beam.sdk.options.PipelineOptions;
 import org.apache.beam.sdk.options.PipelineOptionsFactory;
 import org.apache.beam.sdk.transforms.Aggregator;
 import org.apache.beam.sdk.transforms.Count;
+import org.apache.beam.sdk.transforms.DoFn;
 import org.apache.beam.sdk.transforms.MapElements;
-import org.apache.beam.sdk.transforms.OldDoFn;
 import org.apache.beam.sdk.transforms.PTransform;
 import org.apache.beam.sdk.transforms.ParDo;
 import org.apache.beam.sdk.transforms.SimpleFunction;
@@ -97,14 +97,14 @@ public class WordCount {
 
   /**
    * Concept #2: You can make your pipeline code less verbose by defining your DoFns statically
out-
-   * of-line. This OldDoFn tokenizes lines of text into individual words; we pass it to a
ParDo in
-   * the pipeline.
+   * of-line. This DoFn tokenizes lines of text into individual words; we pass it to a ParDo
in the
+   * pipeline.
    */
-  static class ExtractWordsFn extends OldDoFn<String, String> {
+  static class ExtractWordsFn extends DoFn<String, String> {
     private final Aggregator<Long, Long> emptyLines =
         createAggregator("emptyLines", new Sum.SumLongFn());
 
-    @Override
+    @ProcessElement
     public void processElement(ProcessContext c) {
       if (c.element().trim().isEmpty()) {
         emptyLines.addValue(1L);


Mime
View raw message