From be77afe05cc7e975df28d4dd0f77cd4c10677c8e Mon Sep 17 00:00:00 2001 From: Michel Davit Date: Wed, 2 Oct 2024 16:23:38 +0200 Subject: [PATCH] BigQuey fix invalid null checks in io translation (#32515) --- .../beam/sdk/io/gcp/bigquery/BigQueryIOTranslation.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIOTranslation.java b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIOTranslation.java index ae50a72bae23..561f5ccfc457 100644 --- a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIOTranslation.java +++ b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIOTranslation.java @@ -291,7 +291,7 @@ public TypedRead fromConfigRow(Row configRow, PipelineOptions options) { builder = builder.setMethod((TypedRead.Method) fromByteArray(methodBytes)); } byte[] formatBytes = configRow.getBytes("format"); - if (methodBytes != null) { + if (formatBytes != null) { builder = builder.setFormat((DataFormat) fromByteArray(formatBytes)); } Collection selectedFields = configRow.getArray("selected_fields"); @@ -641,7 +641,7 @@ public Write fromConfigRow(Row configRow, PipelineOptions options) { } byte[] formatRecordOnFailureFunctionBytes = configRow.getBytes("format_record_on_failure_function"); - if (tableFunctionBytes != null) { + if (formatRecordOnFailureFunctionBytes != null) { builder = builder.setFormatRecordOnFailureFunction( (SerializableFunction) @@ -654,7 +654,7 @@ public Write fromConfigRow(Row configRow, PipelineOptions options) { (AvroRowWriterFactory) fromByteArray(avroRowWriterFactoryBytes)); } byte[] avroSchemaFactoryBytes = configRow.getBytes("avro_schema_factory"); - if (tableFunctionBytes != null) { + if (avroSchemaFactoryBytes != null) { builder = builder.setAvroSchemaFactory( (SerializableFunction) fromByteArray(avroSchemaFactoryBytes));