Improve BigQueryIO validation for streaming WriteDisposition

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

Branch: refs/heads/python-sdk
Commit: 0a7246d268969cb1b7f46149e38361802c95e70a
Parents: cfa217a
Author: Scott Wegner <[email protected]>
Authored: Mon Jun 13 11:05:52 2016 -0700
Committer: Davor Bonaci <[email protected]>
Committed: Mon Jun 20 15:14:29 2016 -0700

----------------------------------------------------------------------
 .../core/src/main/java/org/apache/beam/sdk/io/BigQueryIO.java  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/0a7246d2/sdks/java/core/src/main/java/org/apache/beam/sdk/io/BigQueryIO.java
----------------------------------------------------------------------
diff --git 
a/sdks/java/core/src/main/java/org/apache/beam/sdk/io/BigQueryIO.java 
b/sdks/java/core/src/main/java/org/apache/beam/sdk/io/BigQueryIO.java
index 38009bf..1c666ed 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/io/BigQueryIO.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/io/BigQueryIO.java
@@ -201,8 +201,8 @@ import javax.annotation.Nullable;
  *
  * <p>See {@link BigQueryIO.Write} for details on how to specify if a write 
should
  * append to an existing table, replace the table, or verify that the table is
- * empty. Note that the dataset being written to must already exist. Write
- * dispositions are not supported in streaming mode.
+ * empty. Note that the dataset being written to must already exist. Unbounded 
PCollections can only
+ * be written using {@link WriteDisposition#WRITE_EMPTY} or {@link 
WriteDisposition#WRITE_APPEND}.
  *
  * <h3>Sharding BigQuery output tables</h3>
  * <p>A common use case is to dynamically generate BigQuery table names based 
on
@@ -1674,7 +1674,7 @@ public class BigQueryIO {
           }
         }
 
-        if (options.isStreaming() || tableRefFunction != null) {
+        if (input.isBounded() == PCollection.IsBounded.UNBOUNDED || 
tableRefFunction != null) {
           // We will use BigQuery's streaming write API -- validate supported 
dispositions.
           checkArgument(
               createDisposition != CreateDisposition.CREATE_NEVER,

Reply via email to