@Override public Boolean call() { return bigQueryRpc.cancel( completeJobId.getProject(), completeJobId.getJob(), completeJobId.getLocation()); } },
@Override public com.google.api.services.bigquery.model.Job call() { return bigQueryRpc.getJob( completeJobId.getProject(), completeJobId.getJob(), completeJobId.getLocation(), optionsMap); } },
JobId setLocation(String location) { return getLocation() != null ? this : toBuilder().setLocation(location).build(); }
@Override public GetQueryResultsResponse call() { return serviceOptions .getBigQueryRpcV2() .getQueryResults( completeJobId.getProject(), completeJobId.getJob(), completeJobId.getLocation(), optionsMap); } },
JobReference toPb() { return new JobReference() .setProjectId(getProject()) .setJobId(getJob()) .setLocation(getLocation()); }
@Override public boolean cancel(JobId jobId) { final JobId completeJobId = jobId .setProjectId(getOptions().getProjectId()) .setLocation( jobId.getLocation() == null && getOptions().getLocation() != null ? getOptions().getLocation() : jobId.getLocation()); try { return runWithRetries( new Callable<Boolean>() { @Override public Boolean call() { return bigQueryRpc.cancel( completeJobId.getProject(), completeJobId.getJob(), completeJobId.getLocation()); } }, getOptions().getRetrySettings(), EXCEPTION_HANDLER, getOptions().getClock()); } catch (RetryHelper.RetryHelperException e) { throw BigQueryException.translateAndThrow(e); } }
.setProjectId(serviceOptions.getProjectId()) .setLocation( jobId.getLocation() == null && serviceOptions.getLocation() != null ? serviceOptions.getLocation() : jobId.getLocation()); try { GetQueryResultsResponse results =
.setProjectId(getOptions().getProjectId()) .setLocation( jobId.getLocation() == null && getOptions().getLocation() != null ? getOptions().getLocation() : jobId.getLocation()); try { com.google.api.services.bigquery.model.Job answer =
/** Example of running a batch query. */ public void runBatchQuery() throws TimeoutException, InterruptedException { // [START bigquery_query_batch] // BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService(); String query = "SELECT corpus FROM `bigquery-public-data.samples.shakespeare` GROUP BY corpus;"; QueryJobConfiguration queryConfig = QueryJobConfiguration.newBuilder(query) // Run at batch priority, which won't count toward concurrent rate // limit. .setPriority(QueryJobConfiguration.Priority.BATCH) .build(); // Location must match that of the dataset(s) referenced in the query. JobId jobId = JobId.newBuilder().setRandomJob().setLocation("US").build(); String jobIdString = jobId.getJob(); // API request - starts the query. bigquery.create(JobInfo.newBuilder(queryConfig).setJobId(jobId).build()); // Check on the progress by getting the job's updated state. Once the state // is `DONE`, the results are ready. Job queryJob = bigquery.getJob(JobId.newBuilder().setJob(jobIdString).setLocation("US").build()); System.out.printf( "Job %s in location %s currently in state: %s%n", queryJob.getJobId().getJob(), queryJob.getJobId().getLocation(), queryJob.getStatus().getState().toString()); // [END bigquery_query_batch] }
assertThat(job.getStatus().getError()).isNull(); assertThat(job.getJobId().getLocation()).isEqualTo(location);
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof JobId) { JobId that = (JobId) o; return ((this.project == null) ? (that.getProject() == null) : this.project.equals(that.getProject())) && ((this.job == null) ? (that.getJob() == null) : this.job.equals(that.getJob())) && ((this.location == null) ? (that.getLocation() == null) : this.location.equals(that.getLocation())); } return false; }
private Builder(JobId source) { this.project = source.getProject(); this.job = source.getJob(); this.location = source.getLocation(); } @Override
@Override public com.google.api.services.bigquery.model.Job call() { return bigQueryRpc.getJob( completeJobId.getProject(), completeJobId.getJob(), completeJobId.getLocation(), optionsMap); } },
@Override public Boolean call() { return bigQueryRpc.cancel( completeJobId.getProject(), completeJobId.getJob(), completeJobId.getLocation()); } },
@Override public GetQueryResultsResponse call() { return serviceOptions .getBigQueryRpcV2() .getQueryResults( completeJobId.getProject(), completeJobId.getJob(), completeJobId.getLocation(), optionsMap); } },
JobReference toPb() { return new JobReference() .setProjectId(getProject()) .setJobId(getJob()) .setLocation(getLocation()); }