Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public final class CopyJobConfiguration extends JobConfiguration {
private final JobInfo.WriteDisposition writeDisposition;
private final EncryptionConfiguration destinationEncryptionConfiguration;
private final Map<String, String> labels;
private final Long jobTimeoutMs;

public static final class Builder
extends JobConfiguration.Builder<CopyJobConfiguration, Builder> {
Expand All @@ -52,6 +53,7 @@ public static final class Builder
private JobInfo.WriteDisposition writeDisposition;
private EncryptionConfiguration destinationEncryptionConfiguration;
private Map<String, String> labels;
private Long jobTimeoutMs;

private Builder() {
super(Type.COPY);
Expand All @@ -65,6 +67,7 @@ private Builder(CopyJobConfiguration jobConfiguration) {
this.writeDisposition = jobConfiguration.writeDisposition;
this.destinationEncryptionConfiguration = jobConfiguration.destinationEncryptionConfiguration;
this.labels = jobConfiguration.labels;
this.jobTimeoutMs = jobConfiguration.jobTimeoutMs;
}

private Builder(com.google.api.services.bigquery.model.JobConfiguration configurationPb) {
Expand Down Expand Up @@ -94,6 +97,9 @@ private Builder(com.google.api.services.bigquery.model.JobConfiguration configur
if (configurationPb.getLabels() != null) {
this.labels = configurationPb.getLabels();
}
if (configurationPb.getJobTimeoutMs() != null) {
this.jobTimeoutMs = configurationPb.getJobTimeoutMs();
}
}

/** Sets the source tables to copy. */
Expand Down Expand Up @@ -152,6 +158,17 @@ public Builder setLabels(Map<String, String> labels) {
return this;
}

/**
* [Optional] Job timeout in milliseconds. If this time limit is exceeded, BigQuery may attempt
* to terminate the job.
*
* @param jobTimeoutMs jobTimeoutMs or {@code null} for none
*/
public Builder setJobTimeoutMs(Long jobTimeoutMs) {
this.jobTimeoutMs = jobTimeoutMs;
return this;
}

public CopyJobConfiguration build() {
return new CopyJobConfiguration(this);
}
Expand All @@ -165,6 +182,7 @@ private CopyJobConfiguration(Builder builder) {
this.writeDisposition = builder.writeDisposition;
this.destinationEncryptionConfiguration = builder.destinationEncryptionConfiguration;
this.labels = builder.labels;
this.jobTimeoutMs = builder.jobTimeoutMs;
}

/** Returns the source tables to copy. */
Expand Down Expand Up @@ -208,6 +226,11 @@ public Map<String, String> getLabels() {
return labels;
}

/** Returns the timeout associated with this job */
public Long getJobTimeoutMs() {
return jobTimeoutMs;
}

@Override
public Builder toBuilder() {
return new Builder(this);
Expand All @@ -221,7 +244,8 @@ ToStringHelper toStringHelper() {
.add("destinationEncryptionConfiguration", destinationEncryptionConfiguration)
.add("createDisposition", createDisposition)
.add("writeDisposition", writeDisposition)
.add("labels", labels);
.add("labels", labels)
.add("jobTimeoutMs", jobTimeoutMs);
}

@Override
Expand All @@ -238,7 +262,8 @@ public int hashCode() {
destinationTable,
createDisposition,
writeDisposition,
labels);
labels,
jobTimeoutMs);
}

@Override
Expand Down Expand Up @@ -286,6 +311,9 @@ com.google.api.services.bigquery.model.JobConfiguration toPb() {
if (labels != null) {
jobConfiguration.setLabels(labels);
}
if (jobTimeoutMs != null) {
jobConfiguration.setJobTimeoutMs(jobTimeoutMs);
}
jobConfiguration.setCopy(configurationPb);
return jobConfiguration;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public final class ExtractJobConfiguration extends JobConfiguration {
private final String compression;
private final Boolean useAvroLogicalTypes;
private final Map<String, String> labels;
private final Long jobTimeoutMs;

public static final class Builder
extends JobConfiguration.Builder<ExtractJobConfiguration, Builder> {
Expand All @@ -57,6 +58,7 @@ public static final class Builder
private String compression;
private Boolean useAvroLogicalTypes;
private Map<String, String> labels;
private Long jobTimeoutMs;

private Builder() {
super(Type.EXTRACT);
Expand All @@ -72,6 +74,7 @@ private Builder(ExtractJobConfiguration jobInfo) {
this.compression = jobInfo.compression;
this.useAvroLogicalTypes = jobInfo.useAvroLogicalTypes;
this.labels = jobInfo.labels;
this.jobTimeoutMs = jobInfo.jobTimeoutMs;
}

private Builder(com.google.api.services.bigquery.model.JobConfiguration configurationPb) {
Expand All @@ -87,6 +90,9 @@ private Builder(com.google.api.services.bigquery.model.JobConfiguration configur
if (configurationPb.getLabels() != null) {
this.labels = configurationPb.getLabels();
}
if (configurationPb.getJobTimeoutMs() != null) {
this.jobTimeoutMs = configurationPb.getJobTimeoutMs();
}
}

/** Sets the table to export. */
Expand Down Expand Up @@ -167,6 +173,17 @@ public Builder setLabels(Map<String, String> labels) {
return this;
}

/**
* [Optional] Job timeout in milliseconds. If this time limit is exceeded, BigQuery may attempt
* to terminate the job.
*
* @param jobTimeoutMs jobTimeoutMs or {@code null} for none
*/
public Builder setJobTimeoutMs(Long jobTimeoutMs) {
this.jobTimeoutMs = jobTimeoutMs;
return this;
}

public ExtractJobConfiguration build() {
return new ExtractJobConfiguration(this);
}
Expand All @@ -182,6 +199,7 @@ private ExtractJobConfiguration(Builder builder) {
this.compression = builder.compression;
this.useAvroLogicalTypes = builder.useAvroLogicalTypes;
this.labels = builder.labels;
this.jobTimeoutMs = builder.jobTimeoutMs;
}

/** Returns the table to export. */
Expand Down Expand Up @@ -231,6 +249,11 @@ public Map<String, String> getLabels() {
return labels;
}

/** Returns the timeout associated with this job */
public Long getJobTimeoutMs() {
return jobTimeoutMs;
}

@Override
public Builder toBuilder() {
return new Builder(this);
Expand All @@ -246,7 +269,8 @@ ToStringHelper toStringHelper() {
.add("fieldDelimiter", fieldDelimiter)
.add("compression", compression)
.add("useAvroLogicalTypes", useAvroLogicalTypes)
.add("labels", labels);
.add("labels", labels)
.add("jobTimeoutMs", jobTimeoutMs);
}

@Override
Expand All @@ -266,7 +290,8 @@ public int hashCode() {
format,
compression,
useAvroLogicalTypes,
labels);
labels,
jobTimeoutMs);
}

@Override
Expand All @@ -292,6 +317,9 @@ com.google.api.services.bigquery.model.JobConfiguration toPb() {
if (labels != null) {
jobConfiguration.setLabels(labels);
}
if (jobTimeoutMs != null) {
jobConfiguration.setJobTimeoutMs(jobTimeoutMs);
}
jobConfiguration.setExtract(extractConfigurationPb);
return jobConfiguration;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public final class LoadJobConfiguration extends JobConfiguration implements Load
private final Clustering clustering;
private final Boolean useAvroLogicalTypes;
private final Map<String, String> labels;
private final Long jobTimeoutMs;

public static final class Builder extends JobConfiguration.Builder<LoadJobConfiguration, Builder>
implements LoadConfiguration.Builder {
Expand All @@ -73,6 +74,7 @@ public static final class Builder extends JobConfiguration.Builder<LoadJobConfig
private Clustering clustering;
private Boolean useAvroLogicalTypes;
private Map<String, String> labels;
private Long jobTimeoutMs;

private Builder() {
super(Type.LOAD);
Expand All @@ -97,6 +99,7 @@ private Builder(LoadJobConfiguration loadConfiguration) {
this.clustering = loadConfiguration.clustering;
this.useAvroLogicalTypes = loadConfiguration.useAvroLogicalTypes;
this.labels = loadConfiguration.labels;
this.jobTimeoutMs = loadConfiguration.jobTimeoutMs;
}

private Builder(com.google.api.services.bigquery.model.JobConfiguration configurationPb) {
Expand Down Expand Up @@ -173,6 +176,9 @@ private Builder(com.google.api.services.bigquery.model.JobConfiguration configur
if (configurationPb.getLabels() != null) {
this.labels = configurationPb.getLabels();
}
if (configurationPb.getJobTimeoutMs() != null) {
this.jobTimeoutMs = configurationPb.getJobTimeoutMs();
}
}

@Override
Expand Down Expand Up @@ -284,6 +290,17 @@ public Builder setLabels(Map<String, String> labels) {
return this;
}

/**
* [Optional] Job timeout in milliseconds. If this time limit is exceeded, BigQuery may attempt
* to terminate the job.
*
* @param jobTimeoutMs jobTimeoutMs or {@code null} for none
*/
public Builder setJobTimeoutMs(Long jobTimeoutMs) {
this.jobTimeoutMs = jobTimeoutMs;
return this;
}

@Override
public LoadJobConfiguration build() {
return new LoadJobConfiguration(this);
Expand All @@ -308,6 +325,7 @@ private LoadJobConfiguration(Builder builder) {
this.clustering = builder.clustering;
this.useAvroLogicalTypes = builder.useAvroLogicalTypes;
this.labels = builder.labels;
this.jobTimeoutMs = builder.jobTimeoutMs;
}

@Override
Expand Down Expand Up @@ -405,6 +423,11 @@ public Map<String, String> getLabels() {
return labels;
}

/** Returns the timeout associated with this job */
public Long getJobTimeoutMs() {
return jobTimeoutMs;
}

@Override
public Builder toBuilder() {
return new Builder(this);
Expand All @@ -428,7 +451,8 @@ ToStringHelper toStringHelper() {
.add("timePartitioning", timePartitioning)
.add("clustering", clustering)
.add("useAvroLogicalTypes", useAvroLogicalTypes)
.add("labels", labels);
.add("labels", labels)
.add("jobTimeoutMs", jobTimeoutMs);
}

@Override
Expand Down Expand Up @@ -515,6 +539,9 @@ com.google.api.services.bigquery.model.JobConfiguration toPb() {
if (labels != null) {
jobConfiguration.setLabels(labels);
}
if (jobTimeoutMs != null) {
jobConfiguration.setJobTimeoutMs(jobTimeoutMs);
}
jobConfiguration.setLoad(loadConfigurationPb);
return jobConfiguration;
}
Expand Down
Loading