Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -285,14 +285,17 @@ public void validate(@Nullable PipelineOptions maybeOptions) {
PipelineOptions options = Preconditions.checkArgumentNotNull(maybeOptions);
// We will use a BigQuery load job -- validate the temp location.
String tempLocation;
if (customGcsTempLocation == null || customGcsTempLocation.get() == null) {
if (customGcsTempLocation == null) {
tempLocation = options.getTempLocation();
} else {
if (!customGcsTempLocation.isAccessible()) {
// Can't perform verification in this case.
return;
} else if (Strings.isNullOrEmpty(customGcsTempLocation.get())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tarun-google we should add one test later to capture this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tried to add one using RuntimeValueProvider, however using pipeline.newProvider(...) in unit test makes the value provider still accessible at compile time. Looks like one needs a pipeline proto (Dataflow templates) to test the case

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The base implementation itself is a bit odd, It needs pipelineoptions from inputPTransform, which is busted(#33074), and then backs off to pipelineoptions from context during runtime.

tempLocation = options.getTempLocation();
} else {
tempLocation = customGcsTempLocation.get();
}
tempLocation = customGcsTempLocation.get();
}
checkArgument(
!Strings.isNullOrEmpty(tempLocation),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4444,6 +4444,8 @@ public void testUpsertAndDeleteBeamRows() throws Exception {

@Test
public void testCustomGcsTempLocationNull() throws Exception {
assumeTrue(!useStreaming);
assumeTrue(!useStorageApi);
BigQueryIO.Write<TableRow> write =
BigQueryIO.writeTableRows()
.to("dataset-id.table-id")
Expand Down
Loading