beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bchamb...@apache.org
Subject [1/2] incubator-beam git commit: Fix AutoComplete example streaming configuration
Date Tue, 14 Jun 2016 00:41:37 GMT
Repository: incubator-beam
Updated Branches:
  refs/heads/master 915bc198d -> 522762452


Fix AutoComplete example streaming configuration


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

Branch: refs/heads/master
Commit: e60e3e6de85a022d4669333c544b0b86145d0d55
Parents: 915bc19
Author: Scott Wegner <swegner@google.com>
Authored: Mon Jun 13 11:05:00 2016 -0700
Committer: bchambers <bchambers@google.com>
Committed: Mon Jun 13 17:17:22 2016 -0700

----------------------------------------------------------------------
 .../java/org/apache/beam/examples/complete/AutoComplete.java   | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/e60e3e6d/examples/java/src/main/java/org/apache/beam/examples/complete/AutoComplete.java
----------------------------------------------------------------------
diff --git a/examples/java/src/main/java/org/apache/beam/examples/complete/AutoComplete.java
b/examples/java/src/main/java/org/apache/beam/examples/complete/AutoComplete.java
index ac8384b..d725e0a 100644
--- a/examples/java/src/main/java/org/apache/beam/examples/complete/AutoComplete.java
+++ b/examples/java/src/main/java/org/apache/beam/examples/complete/AutoComplete.java
@@ -31,6 +31,7 @@ import org.apache.beam.sdk.io.TextIO;
 import org.apache.beam.sdk.options.Default;
 import org.apache.beam.sdk.options.Description;
 import org.apache.beam.sdk.options.PipelineOptionsFactory;
+import org.apache.beam.sdk.options.Validation;
 import org.apache.beam.sdk.transforms.Count;
 import org.apache.beam.sdk.transforms.DoFn;
 import org.apache.beam.sdk.transforms.Filter;
@@ -416,6 +417,7 @@ public class AutoComplete {
    */
   private static interface Options extends ExamplePubsubTopicOptions, ExampleBigQueryTableOptions
{
     @Description("Input text file")
+    @Validation.Required
     String getInputFile();
     void setInputFile(String value);
 
@@ -494,7 +496,9 @@ public class AutoComplete {
                .to(tableRef)
                .withSchema(FormatForBigquery.getSchema())
                .withCreateDisposition(BigQueryIO.Write.CreateDisposition.CREATE_IF_NEEDED)
-               .withWriteDisposition(BigQueryIO.Write.WriteDisposition.WRITE_TRUNCATE));
+               .withWriteDisposition(options.isStreaming()
+                   ? BigQueryIO.Write.WriteDisposition.WRITE_APPEND
+                   : BigQueryIO.Write.WriteDisposition.WRITE_TRUNCATE));
     }
 
     // Run the pipeline.


Mime
View raw message