beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From k...@apache.org
Subject [1/3] incubator-beam git commit: Changed Word Counts to use TypeDescriptors.
Date Mon, 13 Jun 2016 18:04:40 GMT
Repository: incubator-beam
Updated Branches:
  refs/heads/master a3feeefa2 -> dbddb9f3c


Changed Word Counts to use TypeDescriptors.


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

Branch: refs/heads/master
Commit: f0e266bbd1f5781f5280703876b9fd76c7836090
Parents: 8291219
Author: Jesse Anderson <jesse@smokinghand.com>
Authored: Mon May 16 13:58:08 2016 -0700
Committer: Jesse Anderson <jesse@smokinghand.com>
Committed: Sat Jun 11 08:02:54 2016 -0700

----------------------------------------------------------------------
 .../java/org/apache/beam/examples/MinimalWordCountJava8.java   | 6 +++---
 .../org/apache/beam/examples/MinimalWordCountJava8Test.java    | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/f0e266bb/examples/java8/src/main/java/org/apache/beam/examples/MinimalWordCountJava8.java
----------------------------------------------------------------------
diff --git a/examples/java8/src/main/java/org/apache/beam/examples/MinimalWordCountJava8.java
b/examples/java8/src/main/java/org/apache/beam/examples/MinimalWordCountJava8.java
index 398d517..d491741 100644
--- a/examples/java8/src/main/java/org/apache/beam/examples/MinimalWordCountJava8.java
+++ b/examples/java8/src/main/java/org/apache/beam/examples/MinimalWordCountJava8.java
@@ -27,7 +27,7 @@ import org.apache.beam.sdk.transforms.Filter;
 import org.apache.beam.sdk.transforms.FlatMapElements;
 import org.apache.beam.sdk.transforms.MapElements;
 import org.apache.beam.sdk.values.KV;
-import org.apache.beam.sdk.values.TypeDescriptor;
+import org.apache.beam.sdk.values.TypeDescriptors;
 
 import java.util.Arrays;
 
@@ -54,12 +54,12 @@ public class MinimalWordCountJava8 {
 
     p.apply(TextIO.Read.from("gs://dataflow-samples/shakespeare/*"))
      .apply(FlatMapElements.via((String word) -> Arrays.asList(word.split("[^a-zA-Z']+")))
-         .withOutputType(new TypeDescriptor<String>() {}))
+         .withOutputType(TypeDescriptors.strings()))
      .apply(Filter.byPredicate((String word) -> !word.isEmpty()))
      .apply(Count.<String>perElement())
      .apply(MapElements
          .via((KV<String, Long> wordCount) -> wordCount.getKey() + ": " + wordCount.getValue())
-         .withOutputType(new TypeDescriptor<String>() {}))
+         .withOutputType(TypeDescriptors.strings()))
 
      // CHANGE 3 of 3: The Google Cloud Storage path is required for outputting the results
to.
      .apply(TextIO.Write.to("gs://YOUR_OUTPUT_BUCKET/AND_OUTPUT_PREFIX"));

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/f0e266bb/examples/java8/src/test/java/org/apache/beam/examples/MinimalWordCountJava8Test.java
----------------------------------------------------------------------
diff --git a/examples/java8/src/test/java/org/apache/beam/examples/MinimalWordCountJava8Test.java
b/examples/java8/src/test/java/org/apache/beam/examples/MinimalWordCountJava8Test.java
index ae92559..f73250f 100644
--- a/examples/java8/src/test/java/org/apache/beam/examples/MinimalWordCountJava8Test.java
+++ b/examples/java8/src/test/java/org/apache/beam/examples/MinimalWordCountJava8Test.java
@@ -28,7 +28,7 @@ import org.apache.beam.sdk.transforms.MapElements;
 import org.apache.beam.sdk.util.GcsUtil;
 import org.apache.beam.sdk.util.gcsfs.GcsPath;
 import org.apache.beam.sdk.values.KV;
-import org.apache.beam.sdk.values.TypeDescriptor;
+import org.apache.beam.sdk.values.TypeDescriptors;
 
 import com.google.common.collect.ImmutableList;
 
@@ -65,12 +65,12 @@ public class MinimalWordCountJava8Test implements Serializable {
 
     p.apply(TextIO.Read.from("gs://dataflow-samples/shakespeare/*"))
      .apply(FlatMapElements.via((String word) -> Arrays.asList(word.split("[^a-zA-Z']+")))
-         .withOutputType(new TypeDescriptor<String>() {}))
+         .withOutputType(TypeDescriptors.strings()))
      .apply(Filter.byPredicate((String word) -> !word.isEmpty()))
      .apply(Count.<String>perElement())
      .apply(MapElements
          .via((KV<String, Long> wordCount) -> wordCount.getKey() + ": " + wordCount.getValue())
-         .withOutputType(new TypeDescriptor<String>() {}))
+         .withOutputType(TypeDescriptors.strings()))
      .apply(TextIO.Write.to("gs://YOUR_OUTPUT_BUCKET/AND_OUTPUT_PREFIX"));
   }
 


Mime
View raw message