Skip to content

Commit bb7e709

Browse files
mikekappongad
authored andcommitted
Throw the creation exception if there isn't a job created (#3163)
`getJob` returns `null` when a job wasn't actually created - e.g. when you're running a dry run query
1 parent cc1c6df commit bb7e709

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryImpl.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,16 @@ public com.google.api.services.bigquery.model.Job call() {
234234
// and get might work.
235235
// We can only do this if we randomly generated the ID. Otherwise we might mistakenly
236236
// fetch a job created by someone else.
237+
Job job;
237238
try {
238-
return getJob(jobInfo.getJobId());
239+
job = getJob(jobInfo.getJobId());
239240
} catch (BigQueryException e) {
240241
throw createException;
241242
}
243+
if (job == null) {
244+
throw createException;
245+
}
246+
return job;
242247
}
243248

244249
@Override

0 commit comments

Comments
 (0)