Skip to content

Commit 5729522

Browse files
authored
Merge pull request #36567 from Abacn/cp-36564
[Release-2.69] Cherry-pick #36564 into release branch
2 parents c6e2df0 + 7d85f18 commit 5729522

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,14 +285,17 @@ public void validate(@Nullable PipelineOptions maybeOptions) {
285285
PipelineOptions options = Preconditions.checkArgumentNotNull(maybeOptions);
286286
// We will use a BigQuery load job -- validate the temp location.
287287
String tempLocation;
288-
if (customGcsTempLocation == null || customGcsTempLocation.get() == null) {
288+
if (customGcsTempLocation == null) {
289289
tempLocation = options.getTempLocation();
290290
} else {
291291
if (!customGcsTempLocation.isAccessible()) {
292292
// Can't perform verification in this case.
293293
return;
294+
} else if (Strings.isNullOrEmpty(customGcsTempLocation.get())) {
295+
tempLocation = options.getTempLocation();
296+
} else {
297+
tempLocation = customGcsTempLocation.get();
294298
}
295-
tempLocation = customGcsTempLocation.get();
296299
}
297300
checkArgument(
298301
!Strings.isNullOrEmpty(tempLocation),

sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIOWriteTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4444,6 +4444,8 @@ public void testUpsertAndDeleteBeamRows() throws Exception {
44444444

44454445
@Test
44464446
public void testCustomGcsTempLocationNull() throws Exception {
4447+
assumeTrue(!useStreaming);
4448+
assumeTrue(!useStorageApi);
44474449
BigQueryIO.Write<TableRow> write =
44484450
BigQueryIO.writeTableRows()
44494451
.to("dataset-id.table-id")

0 commit comments

Comments
 (0)