beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dhalp...@apache.org
Subject [1/2] beam git commit: [BEAM-59] Minor style cleanups to WriteOneWindowPerFile
Date Mon, 01 May 2017 00:12:21 GMT
Repository: beam
Updated Branches:
  refs/heads/master 46ca02aba -> a198f8d23


[BEAM-59] Minor style cleanups to WriteOneWindowPerFile

Makes the changes in #2779 more standalone


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

Branch: refs/heads/master
Commit: 1ecc6ebad39f11df8fc3dc7d34cb69599c284230
Parents: 46ca02a
Author: Dan Halperin <dhalperi@google.com>
Authored: Sun Apr 30 10:57:56 2017 -0700
Committer: Dan Halperin <dhalperi@google.com>
Committed: Sun Apr 30 17:12:08 2017 -0700

----------------------------------------------------------------------
 .../beam/examples/common/WriteOneFilePerWindow.java      | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/1ecc6eba/examples/java/src/main/java/org/apache/beam/examples/common/WriteOneFilePerWindow.java
----------------------------------------------------------------------
diff --git a/examples/java/src/main/java/org/apache/beam/examples/common/WriteOneFilePerWindow.java
b/examples/java/src/main/java/org/apache/beam/examples/common/WriteOneFilePerWindow.java
index 2ed8a74..6609828 100644
--- a/examples/java/src/main/java/org/apache/beam/examples/common/WriteOneFilePerWindow.java
+++ b/examples/java/src/main/java/org/apache/beam/examples/common/WriteOneFilePerWindow.java
@@ -38,8 +38,8 @@ import org.joda.time.format.ISODateTimeFormat;
  */
 public class WriteOneFilePerWindow extends PTransform<PCollection<String>, PDone>
{
 
-  private static DateTimeFormatter formatter = ISODateTimeFormat.hourMinute();
-  private String filenamePrefix;
+  private static final DateTimeFormatter FORMATTER = ISODateTimeFormat.hourMinute();
+  private final String filenamePrefix;
 
   public WriteOneFilePerWindow(String filenamePrefix) {
     this.filenamePrefix = filenamePrefix;
@@ -48,7 +48,10 @@ public class WriteOneFilePerWindow extends PTransform<PCollection<String>,
PDone
   @Override
   public PDone expand(PCollection<String> input) {
     return input.apply(
-        TextIO.Write.to(new PerWindowFiles(filenamePrefix)).withWindowedWrites().withNumShards(3));
+        TextIO.Write
+            .to(new PerWindowFiles(filenamePrefix))
+            .withWindowedWrites()
+            .withNumShards(3));
   }
 
   /**
@@ -72,7 +75,7 @@ public class WriteOneFilePerWindow extends PTransform<PCollection<String>,
PDone
 
     public String   filenamePrefixForWindow(IntervalWindow window) {
       return String.format(
-          "%s-%s-%s", output, formatter.print(window.start()), formatter.print(window.end()));
+          "%s-%s-%s", output, FORMATTER.print(window.start()), FORMATTER.print(window.end()));
     }
 
     @Override


Mime
View raw message