Skip to content

Commit 3394f4d

Browse files
Praful Makanichingor13
authored andcommitted
---
yaml --- r: 15983 b: refs/heads/autosynth-errorreporting c: 70d7efb h: refs/heads/master i: 15981: 38d0895 15979: cc02499 15975: f362263 15967: b091ccd
1 parent 0dd7d21 commit 3394f4d

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ refs/heads/autosynth-bigtable-admin: 6379a2bc712f2736c83de0e009b4d26da4fa82ca
131131
refs/heads/autosynth-containeranalysis: 039ca5b8db725c76c16a965ff26b2774322b8ef8
132132
refs/heads/autosynth-datastore: 9acd400b484d6691a080c9152a331d88d24fefc1
133133
refs/heads/autosynth-dialogflow: d7477419376eac9b6dcc7dbcede581152527351d
134-
refs/heads/autosynth-errorreporting: 6e2c2dd890fe445cc896f0ddcb30309213759ee2
134+
refs/heads/autosynth-errorreporting: 70d7efb2a5c33e6755a6c4c3ce0e52f2dee75c87
135135
refs/heads/autosynth-firestore: 92b27fbc8855c9902168695abb0a8f1f433b750b
136136
refs/heads/autosynth-iot: 9d732be07d99843d8cb53d34ec0837328a807fce
137137
refs/heads/autosynth-kms: dcc6e15d68759010c8735cc868135bd7e6c1cc5f

branches/autosynth-errorreporting/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/QueryJobConfiguration.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public final class QueryJobConfiguration extends JobConfiguration {
6060
private final Boolean dryRun;
6161
private final Boolean useLegacySql;
6262
private final Integer maximumBillingTier;
63+
private final Long maximumBytesBilled;
6364
private final List<SchemaUpdateOption> schemaUpdateOptions;
6465
private final EncryptionConfiguration destinationEncryptionConfiguration;
6566
private final TimePartitioning timePartitioning;
@@ -104,6 +105,7 @@ public static final class Builder
104105
private Boolean dryRun;
105106
private Boolean useLegacySql = false;
106107
private Integer maximumBillingTier;
108+
private Long maximumBytesBilled;
107109
private List<SchemaUpdateOption> schemaUpdateOptions;
108110
private EncryptionConfiguration destinationEncryptionConfiguration;
109111
private TimePartitioning timePartitioning;
@@ -131,6 +133,7 @@ private Builder(QueryJobConfiguration jobConfiguration) {
131133
this.dryRun = jobConfiguration.dryRun;
132134
this.useLegacySql = jobConfiguration.useLegacySql;
133135
this.maximumBillingTier = jobConfiguration.maximumBillingTier;
136+
this.maximumBytesBilled = jobConfiguration.maximumBytesBilled;
134137
this.schemaUpdateOptions = jobConfiguration.schemaUpdateOptions;
135138
this.destinationEncryptionConfiguration = jobConfiguration.destinationEncryptionConfiguration;
136139
this.timePartitioning = jobConfiguration.timePartitioning;
@@ -167,6 +170,9 @@ private Builder(com.google.api.services.bigquery.model.JobConfiguration configur
167170
if (queryConfigurationPb.getMaximumBillingTier() != null) {
168171
maximumBillingTier = queryConfigurationPb.getMaximumBillingTier();
169172
}
173+
if (queryConfigurationPb.getMaximumBytesBilled() != null) {
174+
maximumBytesBilled = queryConfigurationPb.getMaximumBytesBilled();
175+
}
170176
dryRun = configurationPb.getDryRun();
171177
if (queryConfigurationPb.getDestinationTable() != null) {
172178
destinationTable = TableId.fromPb(queryConfigurationPb.getDestinationTable());
@@ -482,6 +488,18 @@ public Builder setMaximumBillingTier(Integer maximumBillingTier) {
482488
return this;
483489
}
484490

491+
/**
492+
* Limits the bytes billed for this job. Queries that will have bytes billed beyond this limit
493+
* will fail (without incurring a charge). If unspecified, this will be set to your project
494+
* default.
495+
*
496+
* @param maximumBytesBilled maximum bytes billed for this job
497+
*/
498+
public Builder setMaximumBytesBilled(Long maximumBytesBilled) {
499+
this.maximumBytesBilled = maximumBytesBilled;
500+
return this;
501+
}
502+
485503
/**
486504
* [Experimental] Sets options allowing the schema of the destination table to be updated as a
487505
* side effect of the query job. Schema update options are supported in two cases: when
@@ -538,6 +556,7 @@ private QueryJobConfiguration(Builder builder) {
538556
this.dryRun = builder.dryRun;
539557
this.useLegacySql = builder.useLegacySql;
540558
this.maximumBillingTier = builder.maximumBillingTier;
559+
this.maximumBytesBilled = builder.maximumBytesBilled;
541560
this.schemaUpdateOptions = builder.schemaUpdateOptions;
542561
this.destinationEncryptionConfiguration = builder.destinationEncryptionConfiguration;
543562
this.timePartitioning = builder.timePartitioning;
@@ -685,6 +704,11 @@ public Integer getMaximumBillingTier() {
685704
return maximumBillingTier;
686705
}
687706

707+
/** Returns the optional bytes billed limit for this job. */
708+
public Long getMaximumBytesBilled() {
709+
return maximumBytesBilled;
710+
}
711+
688712
/**
689713
* [Experimental] Returns options allowing the schema of the destination table to be updated as a
690714
* side effect of the query job. Schema update options are supported in two cases: when
@@ -731,6 +755,7 @@ ToStringHelper toStringHelper() {
731755
.add("dryRun", dryRun)
732756
.add("useLegacySql", useLegacySql)
733757
.add("maximumBillingTier", maximumBillingTier)
758+
.add("maximumBytesBilled", maximumBytesBilled)
734759
.add("schemaUpdateOptions", schemaUpdateOptions)
735760
.add("timePartitioning", timePartitioning)
736761
.add("clustering", clustering);
@@ -762,6 +787,7 @@ public int hashCode() {
762787
dryRun,
763788
useLegacySql,
764789
maximumBillingTier,
790+
maximumBytesBilled,
765791
schemaUpdateOptions,
766792
timePartitioning,
767793
clustering);
@@ -835,6 +861,9 @@ com.google.api.services.bigquery.model.JobConfiguration toPb() {
835861
if (maximumBillingTier != null) {
836862
queryConfigurationPb.setMaximumBillingTier(maximumBillingTier);
837863
}
864+
if (maximumBytesBilled != null) {
865+
queryConfigurationPb.setMaximumBytesBilled(maximumBytesBilled);
866+
}
838867
if (schemaUpdateOptions != null) {
839868
ImmutableList.Builder<String> schemaUpdateOptionsBuilder = new ImmutableList.Builder<>();
840869
for (JobInfo.SchemaUpdateOption schemaUpdateOption : schemaUpdateOptions) {

0 commit comments

Comments
 (0)