You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by pa...@apache.org on 2021/03/12 21:26:06 UTC

[beam] branch master updated: [BEAM-11926] Improve error when missing Beam schema for BigqueryIO

This is an automated email from the ASF dual-hosted git repository.

pabloem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new 79da783  [BEAM-11926] Improve error when missing Beam schema for BigqueryIO
     new 0af8c3b  Merge pull request #14152 from [BEAM-11926] Improve error when missing Beam schema for BigqueryIO
79da783 is described below

commit 79da783ff21e17ef445e40e3c7f6bea5b23c4fc5
Author: Fokko Driesprong <fd...@ebay.com>
AuthorDate: Fri Mar 12 15:24:25 2021 +0100

    [BEAM-11926] Improve error when missing Beam schema for BigqueryIO
---
 .../java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.java | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.java b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.java
index 320f897..d8f3b95 100644
--- a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.java
+++ b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.java
@@ -2479,7 +2479,7 @@ public class BigQueryIO {
                   allToArgs.stream()
                       .filter(Predicates.notNull()::apply)
                       .collect(Collectors.toList())),
-          "Exactly one of jsonTableRef, tableFunction, or " + "dynamicDestinations must be set");
+          "Exactly one of jsonTableRef, tableFunction, or dynamicDestinations must be set");
 
       List<?> allSchemaArgs =
           Lists.newArrayList(getJsonSchema(), getSchemaFromView(), getDynamicDestinations());
@@ -2489,7 +2489,7 @@ public class BigQueryIO {
                   allSchemaArgs.stream()
                       .filter(Predicates.notNull()::apply)
                       .collect(Collectors.toList())),
-          "No more than one of jsonSchema, schemaFromView, or dynamicDestinations may " + "be set");
+          "No more than one of jsonSchema, schemaFromView, or dynamicDestinations may be set");
 
       Method method = resolveMethod(input);
       if (input.isBounded() == IsBounded.UNBOUNDED && method == Method.FILE_LOADS) {
@@ -2587,7 +2587,7 @@ public class BigQueryIO {
               || getSchemaFromView() != null;
 
       if (getUseBeamSchema()) {
-        checkArgument(input.hasSchema());
+        checkArgument(input.hasSchema(), "The input doesn't has a schema");
         optimizeWrites = true;
 
         checkArgument(
@@ -2651,7 +2651,9 @@ public class BigQueryIO {
                   + "A format function is not required if Beam schemas are used.");
         }
       } else {
-        checkArgument(avroRowWriterFactory == null);
+        checkArgument(
+            avroRowWriterFactory == null,
+            "When using a formatFunction, the AvroRowWriterFactory should be null");
         checkArgument(
             formatFunction != null,
             "A function must be provided to convert the input type into a TableRow or "
@@ -2687,7 +2689,7 @@ public class BigQueryIO {
       if (method == Method.STREAMING_INSERTS) {
         checkArgument(
             getWriteDisposition() != WriteDisposition.WRITE_TRUNCATE,
-            "WriteDisposition.WRITE_TRUNCATE is not supported for an unbounded" + " PCollection.");
+            "WriteDisposition.WRITE_TRUNCATE is not supported for an unbounded PCollection.");
         InsertRetryPolicy retryPolicy =
             MoreObjects.firstNonNull(getFailedInsertRetryPolicy(), InsertRetryPolicy.alwaysRetry());