JobInfo setProjectId(String projectId) { Builder builder = toBuilder(); if (jobId != null) { builder.setJobId(jobId.setProjectId(projectId)); } return builder.setConfiguration(configuration.setProjectId(projectId)).build(); }
@Override public String toString() { return toStringHelper().toString(); }
BuilderImpl(Job jobPb) { this.etag = jobPb.getEtag(); this.generatedId = jobPb.getId(); if (jobPb.getJobReference() != null) { this.jobId = JobId.fromPb(jobPb.getJobReference()); } this.selfLink = jobPb.getSelfLink(); if (jobPb.getStatus() != null) { this.status = JobStatus.fromPb(jobPb.getStatus()); } if (jobPb.getStatistics() != null) { this.statistics = JobStatistics.fromPb(jobPb); } this.userEmail = jobPb.getUserEmail(); if (jobPb.getConfiguration() != null) { this.configuration = JobConfiguration.fromPb(jobPb.getConfiguration()); } }
private QueryResponse waitForQueryResults( RetrySettings waitSettings, final QueryResultsOption... resultsOptions) throws InterruptedException { if (getConfiguration().getType() != Type.QUERY) { throw new UnsupportedOperationException( "Waiting for query results is supported only for " + Type.QUERY + " jobs"); } try { return RetryHelper.poll( new Callable<QueryResponse>() { @Override public QueryResponse call() { return bigquery.getQueryResults(getJobId(), resultsOptions); } }, waitSettings, new BasicResultRetryAlgorithm<QueryResponse>() { @Override public boolean shouldRetry(Throwable prevThrowable, QueryResponse prevResponse) { return prevResponse != null && !prevResponse.getCompleted(); } }, options.getClock()); } catch (ExecutionException e) { throw BigQueryException.translateAndThrow(e); } }
BuilderImpl(Job jobPb) { this.etag = jobPb.getEtag(); this.generatedId = jobPb.getId(); if (jobPb.getJobReference() != null) { this.jobId = JobId.fromPb(jobPb.getJobReference()); } this.selfLink = jobPb.getSelfLink(); if (jobPb.getStatus() != null) { this.status = JobStatus.fromPb(jobPb.getStatus()); } if (jobPb.getStatistics() != null) { this.statistics = JobStatistics.fromPb(jobPb.getStatistics()); } this.userEmail = jobPb.getUserEmail(); this.configuration = JobConfiguration.fromPb(jobPb.getConfiguration()); }
throws InterruptedException, JobException { checkNotDryRun("getQueryResults"); if (getConfiguration().getType() != Type.QUERY) { throw new UnsupportedOperationException( "Getting query results is supported only for " + Type.QUERY + " jobs");
@Override ToStringHelper toStringHelper() { return super.toStringHelper() .add("sourceTables", sourceTables) .add("destinationTable", destinationTable) .add("destinationEncryptionConfiguration", destinationEncryptionConfiguration) .add("createDisposition", createDisposition) .add("writeDisposition", writeDisposition); }
Job toPb() { Job jobPb = new Job(); jobPb.setEtag(etag); jobPb.setId(generatedId); jobPb.setSelfLink(selfLink); jobPb.setUserEmail(userEmail); if (jobId != null) { jobPb.setJobReference(jobId.toPb()); } if (status != null) { jobPb.setStatus(status.toPb()); } if (statistics != null) { jobPb.setStatistics(statistics.toPb()); } if (configuration != null) { jobPb.setConfiguration(configuration.toPb()); } return jobPb; }
JobInfo setProjectId(String projectId) { return toBuilder().configuration(configuration.setProjectId(projectId)).build(); }
BuilderImpl(Job jobPb) { this.etag = jobPb.getEtag(); this.generatedId = jobPb.getId(); if (jobPb.getJobReference() != null) { this.jobId = JobId.fromPb(jobPb.getJobReference()); } this.selfLink = jobPb.getSelfLink(); if (jobPb.getStatus() != null) { this.status = JobStatus.fromPb(jobPb.getStatus()); } if (jobPb.getStatistics() != null) { this.statistics = JobStatistics.fromPb(jobPb); } this.userEmail = jobPb.getUserEmail(); if (jobPb.getConfiguration() != null) { this.configuration = JobConfiguration.fromPb(jobPb.getConfiguration()); } }
checkNotDryRun("waitFor"); Object completedJobResponse; if (getConfiguration().getType() == Type.QUERY) { completedJobResponse = waitForQueryResults(
@Override ToStringHelper toStringHelper() { return super.toStringHelper() .add("sourceTable", sourceTable) .add("destinationUris", destinationUris) .add("format", format) .add("printHeader", printHeader) .add("fieldDelimiter", fieldDelimiter) .add("compression", compression); }
JobInfo setProjectId(String projectId) { Builder builder = toBuilder(); if (jobId != null) { builder.setJobId(jobId.setProjectId(projectId)); } return builder.setConfiguration(configuration.setProjectId(projectId)).build(); }
private QueryResponse waitForQueryResults( RetrySettings waitSettings, final QueryResultsOption... resultsOptions) throws InterruptedException { if (getConfiguration().getType() != Type.QUERY) { throw new UnsupportedOperationException( "Waiting for query results is supported only for " + Type.QUERY + " jobs"); } try { return RetryHelper.poll( new Callable<QueryResponse>() { @Override public QueryResponse call() { return bigquery.getQueryResults(getJobId(), resultsOptions); } }, waitSettings, new BasicResultRetryAlgorithm<QueryResponse>() { @Override public boolean shouldRetry(Throwable prevThrowable, QueryResponse prevResponse) { return prevResponse != null && !prevResponse.getCompleted(); } }, options.getClock()); } catch (ExecutionException e) { throw BigQueryException.translateAndThrow(e); } }
@Override ToStringHelper toStringHelper() { return super.toStringHelper() .add("destinationTable", destinationTable) .add("destinationEncryptionConfiguration", destinationEncryptionConfiguration) .add("createDisposition", createDisposition) .add("writeDisposition", writeDisposition) .add("formatOptions", formatOptions) .add("nullMarker", nullMarker) .add("maxBadRecords", maxBadRecords) .add("schema", schema) .add("ignoreUnknownValue", ignoreUnknownValues) .add("sourceUris", sourceUris) .add("schemaUpdateOptions", schemaUpdateOptions) .add("autodetect", autodetect) .add("timePartitioning", timePartitioning) .add("clustering", clustering); }
throws InterruptedException, JobException { checkNotDryRun("getQueryResults"); if (getConfiguration().getType() != Type.QUERY) { throw new UnsupportedOperationException( "Getting query results is supported only for " + Type.QUERY + " jobs");
@Override ToStringHelper toStringHelper() { return super.toStringHelper() .add("query", query) .add("positionalParameters", positionalParameters) .add("namedParameters", namedParameters) .add("destinationTable", destinationTable) .add("destinationEncryptionConfiguration", destinationEncryptionConfiguration) .add("defaultDataset", defaultDataset) .add("allowLargeResults", allowLargeResults) .add("flattenResults", flattenResults) .add("priority", priority) .add("tableDefinitions", tableDefinitions) .add("userQueryCache", useQueryCache) .add("userDefinedFunctions", userDefinedFunctions) .add("createDisposition", createDisposition) .add("writeDisposition", writeDisposition) .add("dryRun", dryRun) .add("useLegacySql", useLegacySql) .add("maximumBillingTier", maximumBillingTier) .add("maximumBytesBilled", maximumBytesBilled) .add("schemaUpdateOptions", schemaUpdateOptions) .add("timePartitioning", timePartitioning) .add("clustering", clustering); }