How to interrupt Google BigQuery iteration?

I try to interrupt the following process:

  Predicate<FieldValueList> interruptionChecker = ...   Consumer<FieldValueList> rowHandler = ...    QueryJobConfiguration queryConfig = QueryJobConfiguration     .newBuilder(queryStatement)     .build();   JobId jobId = JobId.newBuilder().setRandomJob().build();    Job job = bigQuery.create(JobInfo.newBuilder(queryConfig).setJobId(jobId).build()).waitFor();    for (FieldValueList row : job.getQueryResults().iterateAll()) {     System.out.println("interruptionChecker check");     if (interruptionChecker.test(row)) {       bigQuery.getJob(jobId).cancel();       return;     }     rowHandler.accept(row);   } 

But although interruptionChecker returns true and rowHandler is stopped invoked, nevertheless, in the log I still see lots of interruptionChecker check, which means iteration process itself does not stop.

Any ideas how to solve it?

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.