本文整理了Java中com.google.api.services.bigquery.model.Job.getStatistics()
方法的一些代码示例,展示了Job.getStatistics()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Job.getStatistics()
方法的具体详情如下:
包路径:com.google.api.services.bigquery.model.Job
类名称:Job
方法名:getStatistics
[英][Output-only] Information about the job, including starting time and ending time of the job.
[中][仅输出]有关作业的信息,包括作业的开始时间和结束时间。
代码示例来源:origin: googleapis/google-cloud-java
@SuppressWarnings("unchecked")
static <T extends JobStatistics> T fromPb(com.google.api.services.bigquery.model.Job jobPb) {
JobConfiguration jobConfigPb = jobPb.getConfiguration();
com.google.api.services.bigquery.model.JobStatistics statisticPb = jobPb.getStatistics();
if (jobConfigPb.getLoad() != null) {
return (T) LoadStatistics.fromPb(statisticPb);
} else if (jobConfigPb.getExtract() != null) {
return (T) ExtractStatistics.fromPb(statisticPb);
} else if (jobConfigPb.getQuery() != null) {
return (T) QueryStatistics.fromPb(statisticPb);
} else if (jobConfigPb.getCopy() != null) {
return (T) CopyStatistics.fromPb(statisticPb);
} else {
throw new IllegalArgumentException("unknown job configuration: " + jobConfigPb);
}
}
}
代码示例来源:origin: googleapis/google-cloud-java
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());
}
}
代码示例来源:origin: org.apache.beam/beam-sdks-java-io-google-cloud-platform
static List<ResourceId> getExtractFilePaths(String extractDestinationDir, Job extractJob)
throws IOException {
JobStatistics jobStats = extractJob.getStatistics();
List<Long> counts = jobStats.getExtract().getDestinationUriFileCounts();
if (counts.size() != 1) {
String errorMessage =
(counts.isEmpty()
? "No destination uri file count received."
: String.format(
"More than one destination uri file count received. First two are %s, %s",
counts.get(0), counts.get(1)));
throw new RuntimeException(errorMessage);
}
long filesCount = counts.get(0);
ImmutableList.Builder<ResourceId> paths = ImmutableList.builder();
ResourceId extractDestinationDirResourceId =
FileSystems.matchNewResource(extractDestinationDir, true /* isDirectory */);
for (long i = 0; i < filesCount; ++i) {
ResourceId filePath =
extractDestinationDirResourceId.resolve(
String.format("%012d%s", i, ".avro"),
ResolveOptions.StandardResolveOptions.RESOLVE_FILE);
paths.add(filePath);
}
return paths.build();
}
代码示例来源:origin: org.apache.beam/beam-sdks-java-io-google-cloud-platform
switch (jobStatus) {
case SUCCEEDED:
LOG.info("Load job {} succeeded. Statistics: {}", currentJobId, job.getStatistics());
return true;
case UNKNOWN:
代码示例来源:origin: com.google.cloud/gcloud-java-bigquery
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());
}
代码示例来源:origin: com.google.gcloud/gcloud-java-bigquery
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());
}
代码示例来源:origin: com.google.cloud/google-cloud-bigquery
@SuppressWarnings("unchecked")
static <T extends JobStatistics> T fromPb(com.google.api.services.bigquery.model.Job jobPb) {
JobConfiguration jobConfigPb = jobPb.getConfiguration();
com.google.api.services.bigquery.model.JobStatistics statisticPb = jobPb.getStatistics();
if (jobConfigPb.getLoad() != null) {
return (T) LoadStatistics.fromPb(statisticPb);
} else if (jobConfigPb.getExtract() != null) {
return (T) ExtractStatistics.fromPb(statisticPb);
} else if (jobConfigPb.getQuery() != null) {
return (T) QueryStatistics.fromPb(statisticPb);
} else if (jobConfigPb.getCopy() != null) {
return (T) CopyStatistics.fromPb(statisticPb);
} else {
throw new IllegalArgumentException("unknown job configuration: " + jobConfigPb);
}
}
}
代码示例来源:origin: org.apache.beam/beam-sdks-java-io-google-cloud-platform
@Override
public JobStatistics dryRunQuery(
String projectId, JobConfigurationQuery queryConfig, String location)
throws InterruptedException, IOException {
JobReference jobRef = new JobReference().setLocation(location).setProjectId(projectId);
Job job =
new Job()
.setJobReference(jobRef)
.setConfiguration(new JobConfiguration().setQuery(queryConfig).setDryRun(true));
return executeWithRetries(
client.jobs().insert(projectId, job),
String.format(
"Unable to dry run query: %s, aborting after %d retries.",
queryConfig, MAX_RPC_RETRIES),
Sleeper.DEFAULT,
createDefaultBackoff(),
ALWAYS_RETRY)
.getStatistics();
}
代码示例来源:origin: com.spotify/scio-bigquery
client.jobs().insert(projectId, dryRunJob),
String.format("Error when trying to dry run query %s.",
queryConfig.toPrettyString())).getStatistics();
代码示例来源:origin: com.google.cloud/google-cloud-bigquery
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());
}
}
内容来源于网络,如有侵权,请联系作者删除!