Skip to content

Commit da09b1a

Browse files
committed
---
yaml --- r: 6423 b: refs/heads/tswast-patch-1 c: 12aa555 h: refs/heads/master i: 6421: f13cfe3 6419: 3189519 6415: a74ee99
1 parent de44da7 commit da09b1a

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ refs/tags/v0.18.0: 9d193c4c4b9d1c6f21515dd8e50836b9194ec9bb
5757
refs/tags/v0.19.0: e67b56e4d8dad5f9a7b38c9b2107c23c828f2ed5
5858
refs/tags/v0.20.0: 839f7fb7156535146aa1cb2c5aadd8d375d854e8
5959
refs/tags/v0.20.1: 370471f437f1f4f68a11e068df5cd6bf39edb1fa
60-
refs/heads/tswast-patch-1: e3a99c2f9314f938bafd9fd5d19a98a43335bd98
60+
refs/heads/tswast-patch-1: 12aa55591cde5f0f5b3bbf6e4d29c7d049925c5f
6161
refs/heads/pubsub-streaming-pull: 19262b752ee874eb2ca3b950eb2aef44d5a5267b

branches/tswast-patch-1/gcloud-java-bigquery/src/main/java/com/google/gcloud/spi/DefaultBigQueryRpc.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import com.google.api.services.bigquery.model.Job;
3636
import com.google.api.services.bigquery.model.JobList;
3737
import com.google.api.services.bigquery.model.JobReference;
38+
import com.google.api.services.bigquery.model.JobStatus;
3839
import com.google.api.services.bigquery.model.QueryRequest;
3940
import com.google.api.services.bigquery.model.QueryResponse;
4041
import com.google.api.services.bigquery.model.Table;
@@ -220,8 +221,9 @@ public Tuple<String, Iterable<Table>> listTables(String datasetId, Map<Option, ?
220221
.setMaxResults(MAX_RESULTS.getLong(options))
221222
.setPageToken(PAGE_TOKEN.getString(options))
222223
.execute();
224+
Iterable<TableList.Tables> tables = tableList.getTables();
223225
return Tuple.of(tableList.getNextPageToken(),
224-
Iterables.transform(tableList.getTables(),
226+
Iterables.transform(tables != null ? tables : ImmutableList.<TableList.Tables>of(),
225227
new Function<TableList.Tables, Table>() {
226228
@Override
227229
public Table apply(TableList.Tables f) {
@@ -350,11 +352,19 @@ public Tuple<String, Iterable<Job>> listJobs(Map<Option, ?> options) throws BigQ
350352
.setPageToken(PAGE_TOKEN.getString(options))
351353
.setProjection(DEFAULT_PROJECTION)
352354
.execute();
355+
Iterable<JobList.Jobs> jobs = jobsList.getJobs();
353356
return Tuple.of(jobsList.getNextPageToken(),
354-
Iterables.transform(jobsList.getJobs(),
357+
Iterables.transform(jobs != null ? jobs : ImmutableList.<JobList.Jobs>of(),
355358
new Function<JobList.Jobs, Job>() {
356359
@Override
357360
public Job apply(JobList.Jobs f) {
361+
JobStatus statusPb = f.getStatus() != null ? f.getStatus() : new JobStatus();
362+
if (statusPb.getState() == null) {
363+
statusPb.setState(f.getState());
364+
}
365+
if (statusPb.getErrorResult() == null) {
366+
statusPb.setErrorResult(f.getErrorResult());
367+
}
358368
return new Job()
359369
.setConfiguration(f.getConfiguration())
360370
.setId(f.getId())

0 commit comments

Comments
 (0)