Skip to content

Commit 0849646

Browse files
committed
Merge pull request #834 from ajkannan/rename-query-stage-id
Rename QueryStage id to generatedId
2 parents c70d9d7 + 883c60e commit 0849646

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/QueryStage.java

+13-13
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ static QueryStep fromPb(com.google.api.services.bigquery.model.ExplainQueryStep
137137

138138
private final double computeRatioAvg;
139139
private final double computeRatioMax;
140-
private final long id;
140+
private final long generatedId;
141141
private final String name;
142142
private final double readRatioAvg;
143143
private final double readRatioMax;
@@ -153,7 +153,7 @@ static final class Builder {
153153

154154
private double computeRatioAvg;
155155
private double computeRatioMax;
156-
private long id;
156+
private long generatedId;
157157
private String name;
158158
private double readRatioAvg;
159159
private double readRatioMax;
@@ -177,8 +177,8 @@ Builder computeRatioMax(double computeRatioMax) {
177177
return this;
178178
}
179179

180-
Builder id(long id) {
181-
this.id = id;
180+
Builder generatedId(long generatedId) {
181+
this.generatedId = generatedId;
182182
return this;
183183
}
184184

@@ -240,7 +240,7 @@ QueryStage build() {
240240
QueryStage(Builder builder) {
241241
computeRatioAvg = builder.computeRatioAvg;
242242
computeRatioMax = builder.computeRatioMax;
243-
id = builder.id;
243+
generatedId = builder.generatedId;
244244
name = builder.name;
245245
readRatioAvg = builder.readRatioAvg;
246246
readRatioMax = builder.readRatioMax;
@@ -270,10 +270,10 @@ public double computeRatioMax() {
270270
}
271271

272272
/**
273-
* Returns a unique ID for the stage within its plan.
273+
* Returns a unique, server-generated ID for the stage within its plan.
274274
*/
275-
public long id() {
276-
return id;
275+
public long generatedId() {
276+
return generatedId;
277277
}
278278

279279
/**
@@ -357,7 +357,7 @@ public String toString() {
357357
return MoreObjects.toStringHelper(this)
358358
.add("computeRatioAvg", computeRatioAvg)
359359
.add("computeRatioMax", computeRatioMax)
360-
.add("id", id)
360+
.add("generatedId", generatedId)
361361
.add("name", name)
362362
.add("readRatioAvg", readRatioAvg)
363363
.add("readRatioMax", readRatioMax)
@@ -373,7 +373,7 @@ public String toString() {
373373

374374
@Override
375375
public int hashCode() {
376-
return Objects.hash(computeRatioAvg, computeRatioMax, id, name, readRatioAvg, readRatioMax,
376+
return Objects.hash(computeRatioAvg, computeRatioMax, generatedId, name, readRatioAvg, readRatioMax,
377377
recordsRead, recordsWritten, steps, waitRatioAvg, waitRatioMax, writeRatioAvg);
378378
}
379379

@@ -383,7 +383,7 @@ public boolean equals(Object obj) {
383383
return false;
384384
}
385385
QueryStage other = (QueryStage) obj;
386-
return id == other.id
386+
return generatedId == other.generatedId
387387
&& computeRatioAvg == other.computeRatioAvg
388388
&& computeRatioMax == other.computeRatioMax
389389
&& readRatioAvg == other.readRatioAvg
@@ -406,7 +406,7 @@ ExplainQueryStage toPb() {
406406
ExplainQueryStage stagePb = new ExplainQueryStage()
407407
.setComputeRatioAvg(computeRatioAvg)
408408
.setComputeRatioMax(computeRatioMax)
409-
.setId(id)
409+
.setId(generatedId)
410410
.setName(name)
411411
.setReadRatioAvg(readRatioAvg)
412412
.setReadRatioMax(readRatioMax)
@@ -426,7 +426,7 @@ static QueryStage fromPb(com.google.api.services.bigquery.model.ExplainQueryStag
426426
Builder builder = new QueryStage.Builder();
427427
builder.computeRatioAvg(stagePb.getComputeRatioAvg());
428428
builder.computeRatioMax(stagePb.getComputeRatioMax());
429-
builder.id(stagePb.getId());
429+
builder.generatedId(stagePb.getId());
430430
builder.name(stagePb.getName());
431431
builder.readRatioAvg(stagePb.getReadRatioAvg());
432432
builder.readRatioMax(stagePb.getReadRatioMax());

gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/JobStatisticsTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public class JobStatisticsTest {
7171
private static final QueryStage QUERY_STAGE = QueryStage.builder()
7272
.computeRatioAvg(1.1)
7373
.computeRatioMax(2.2)
74-
.id(42L)
74+
.generatedId(42L)
7575
.name("stage")
7676
.readRatioAvg(3.3)
7777
.readRatioMax(4.4)

gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/QueryStageTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class QueryStageTest {
4848
private static final QueryStage QUERY_STAGE = QueryStage.builder()
4949
.computeRatioAvg(COMPUTE_RATIO_AVG)
5050
.computeRatioMax(COMPUTE_RATIO_MAX)
51-
.id(ID)
51+
.generatedId(ID)
5252
.name(NAME)
5353
.readRatioAvg(READ_RATIO_AVG)
5454
.readRatioMax(READ_RATIO_MAX)
@@ -73,7 +73,7 @@ public void testQueryStepConstructor() {
7373
public void testBuilder() {
7474
assertEquals(COMPUTE_RATIO_AVG, QUERY_STAGE.computeRatioAvg(), 0);
7575
assertEquals(COMPUTE_RATIO_MAX, QUERY_STAGE.computeRatioMax(), 0);
76-
assertEquals(ID, QUERY_STAGE.id());
76+
assertEquals(ID, QUERY_STAGE.generatedId());
7777
assertEquals(NAME, QUERY_STAGE.name());
7878
assertEquals(READ_RATIO_AVG, QUERY_STAGE.readRatioAvg(), 0);
7979
assertEquals(READ_RATIO_MAX, QUERY_STAGE.readRatioMax(), 0);
@@ -108,7 +108,7 @@ private void compareQueryStage(QueryStage expected, QueryStage value) {
108108
assertEquals(expected, value);
109109
assertEquals(expected.computeRatioAvg(), value.computeRatioAvg(), 0);
110110
assertEquals(expected.computeRatioMax(), value.computeRatioMax(), 0);
111-
assertEquals(expected.id(), value.id());
111+
assertEquals(expected.generatedId(), value.generatedId());
112112
assertEquals(expected.name(), value.name());
113113
assertEquals(expected.readRatioAvg(), value.readRatioAvg(), 0);
114114
assertEquals(expected.readRatioMax(), value.readRatioMax(), 0);

0 commit comments

Comments
 (0)