Skip to content

Commit 575c5e5

Browse files
committed
Update SpannerReadSchemaTransformProvider.java
1 parent a451185 commit 575c5e5

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/SpannerReadSchemaTransformProvider.java

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -167,24 +167,19 @@ public abstract static class Builder {
167167

168168
public void validate() {
169169
String invalidConfigMessage = "Invalid Cloud Spanner Read configuration: ";
170-
checkNotNull(
171-
this.getProjectId(),
172-
invalidConfigMessage + "Project ID must be specified for SQL query.");
173-
checkNotNull(
174-
this.getInstanceId(),
175-
invalidConfigMessage + "Instance ID must be specified for SQL query.");
176-
checkNotNull(
177-
this.getDatabaseId(),
178-
invalidConfigMessage + "Database ID must be specified for SQL query.");
179-
170+
checkArgument(
171+
!Strings.isNullOrEmpty(this.getInstanceId()),
172+
invalidConfigMessage + "Instance ID must be specified.");
173+
checkArgument(
174+
!Strings.isNullOrEmpty(this.getDatabaseId()),
175+
invalidConfigMessage + "Database ID must be specified.");
180176
if (Strings.isNullOrEmpty(this.getQuery())) {
181-
checkNotNull(
182-
this.getTableId(),
177+
checkArgument(
178+
!Strings.isNullOrEmpty(this.getTableId()),
183179
invalidConfigMessage + "Table name must be specified for table read.");
184180
checkArgument(
185181
this.getColumns() != null && !this.getColumns().isEmpty(),
186182
invalidConfigMessage + "Columns must be specified for table read.");
187-
188183
} else {
189184
checkArgument(
190185
!Strings.isNullOrEmpty(this.getQuery()),
@@ -204,6 +199,7 @@ public static Builder builder() {
204199
}
205200

206201
@SchemaFieldDescription("Specifies the GCP project ID.")
202+
@Nullable
207203
public abstract String getProjectId();
208204

209205
@SchemaFieldDescription("Specifies the Cloud Spanner instance.")

0 commit comments

Comments
 (0)