Skip to content

Commit 1b0b21b

Browse files
Praful Makanistephaniewang526
authored andcommitted
fix: parentjobid in listjobs (#20)
1 parent ec4a6eb commit 1b0b21b

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/spi/v2/HttpBigQueryRpc.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,8 @@ public Tuple<String, Iterable<Job>> listJobs(String projectId, Map<Option, ?> op
510510
.setStateFilter(Option.STATE_FILTER.<List<String>>get(options))
511511
.setMaxResults(Option.MAX_RESULTS.getLong(options))
512512
.setPageToken(Option.PAGE_TOKEN.getString(options))
513-
.setProjection(DEFAULT_PROJECTION);
513+
.setProjection(DEFAULT_PROJECTION)
514+
.setParentJobId(Option.PARENT_JOB_ID.getString(options));
514515
if (Option.MIN_CREATION_TIME.getLong(options) != null) {
515516
request.setMinCreationTime(BigInteger.valueOf(Option.MIN_CREATION_TIME.getLong(options)));
516517
}

google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,6 @@ public void testQuery() throws InterruptedException {
12711271

12721272
@Test
12731273
public void testScriptStatistics() throws InterruptedException {
1274-
long currentTime = System.currentTimeMillis();
12751274
String script =
12761275
"-- Declare a variable to hold names as an array.\n"
12771276
+ "DECLARE top_names ARRAY<STRING>;\n"
@@ -1295,9 +1294,7 @@ public void testScriptStatistics() throws InterruptedException {
12951294
JobStatistics jobStatistics = info.getStatistics();
12961295
String parentJobId = info.getJobId().getJob();
12971296
assertEquals(2, jobStatistics.getNumChildJobs().longValue());
1298-
Page<Job> page =
1299-
bigquery.listJobs(
1300-
JobListOption.parentJobId(parentJobId), JobListOption.minCreationTime(currentTime));
1297+
Page<Job> page = bigquery.listJobs(JobListOption.parentJobId(parentJobId));
13011298
for (Job job : page.iterateAll()) {
13021299
JobStatistics.ScriptStatistics scriptStatistics = job.getStatistics().getScriptStatistics();
13031300
if (scriptStatistics != null) {

0 commit comments

Comments
 (0)