You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/07/15 00:33:28 UTC

[GitHub] [beam] steveniemitz commented on a diff in pull request #16721: [BEAM-10608] Fix additional nullness errors in BigQueryIO

steveniemitz commented on code in PR #16721:
URL: https://github.com/apache/beam/pull/16721#discussion_r921713065


##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/RowWriterFactory.java:
##########
@@ -129,7 +127,18 @@ OutputType getOutputType() {
     @Override
     BigQueryRowWriter<ElementT> createRowWriter(String tempFilePrefix, DestinationT destination)
         throws Exception {
+      if (dynamicDestinations == null) {
+        throw new IllegalStateException(
+            "createRowWriter called when dynamicDestinations is null; forgot to call prepare()?");
+      }
+      if (schemaFactory == null) {
+        throw new IllegalStateException(
+            "createRowWriter called when schemaFactory is null; forgot to call prepare()?");
+      }
       TableSchema tableSchema = dynamicDestinations.getSchema(destination);
+      if (tableSchema == null) {

Review Comment:
   This looks like a regression, in the past it was legal for `tableSchema` to be null here, as long as `schemaFactory` didn't require it.  I'm going to submit a PR to revert this specific null check.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org