Skip to content

Commit

Permalink
Merge pull request #834 from ajkannan/rename-query-stage-id
Browse files Browse the repository at this point in the history
Rename QueryStage id to generatedId
  • Loading branch information
aozarov committed Apr 1, 2016
2 parents c70d9d7 + 883c60e commit 0849646
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ static QueryStep fromPb(com.google.api.services.bigquery.model.ExplainQueryStep

private final double computeRatioAvg;
private final double computeRatioMax;
private final long id;
private final long generatedId;
private final String name;
private final double readRatioAvg;
private final double readRatioMax;
Expand All @@ -153,7 +153,7 @@ static final class Builder {

private double computeRatioAvg;
private double computeRatioMax;
private long id;
private long generatedId;
private String name;
private double readRatioAvg;
private double readRatioMax;
Expand All @@ -177,8 +177,8 @@ Builder computeRatioMax(double computeRatioMax) {
return this;
}

Builder id(long id) {
this.id = id;
Builder generatedId(long generatedId) {
this.generatedId = generatedId;
return this;
}

Expand Down Expand Up @@ -240,7 +240,7 @@ QueryStage build() {
QueryStage(Builder builder) {
computeRatioAvg = builder.computeRatioAvg;
computeRatioMax = builder.computeRatioMax;
id = builder.id;
generatedId = builder.generatedId;
name = builder.name;
readRatioAvg = builder.readRatioAvg;
readRatioMax = builder.readRatioMax;
Expand Down Expand Up @@ -270,10 +270,10 @@ public double computeRatioMax() {
}

/**
* Returns a unique ID for the stage within its plan.
* Returns a unique, server-generated ID for the stage within its plan.
*/
public long id() {
return id;
public long generatedId() {
return generatedId;
}

/**
Expand Down Expand Up @@ -357,7 +357,7 @@ public String toString() {
return MoreObjects.toStringHelper(this)
.add("computeRatioAvg", computeRatioAvg)
.add("computeRatioMax", computeRatioMax)
.add("id", id)
.add("generatedId", generatedId)
.add("name", name)
.add("readRatioAvg", readRatioAvg)
.add("readRatioMax", readRatioMax)
Expand All @@ -373,7 +373,7 @@ public String toString() {

@Override
public int hashCode() {
return Objects.hash(computeRatioAvg, computeRatioMax, id, name, readRatioAvg, readRatioMax,
return Objects.hash(computeRatioAvg, computeRatioMax, generatedId, name, readRatioAvg, readRatioMax,
recordsRead, recordsWritten, steps, waitRatioAvg, waitRatioMax, writeRatioAvg);
}

Expand All @@ -383,7 +383,7 @@ public boolean equals(Object obj) {
return false;
}
QueryStage other = (QueryStage) obj;
return id == other.id
return generatedId == other.generatedId
&& computeRatioAvg == other.computeRatioAvg
&& computeRatioMax == other.computeRatioMax
&& readRatioAvg == other.readRatioAvg
Expand All @@ -406,7 +406,7 @@ ExplainQueryStage toPb() {
ExplainQueryStage stagePb = new ExplainQueryStage()
.setComputeRatioAvg(computeRatioAvg)
.setComputeRatioMax(computeRatioMax)
.setId(id)
.setId(generatedId)
.setName(name)
.setReadRatioAvg(readRatioAvg)
.setReadRatioMax(readRatioMax)
Expand All @@ -426,7 +426,7 @@ static QueryStage fromPb(com.google.api.services.bigquery.model.ExplainQueryStag
Builder builder = new QueryStage.Builder();
builder.computeRatioAvg(stagePb.getComputeRatioAvg());
builder.computeRatioMax(stagePb.getComputeRatioMax());
builder.id(stagePb.getId());
builder.generatedId(stagePb.getId());
builder.name(stagePb.getName());
builder.readRatioAvg(stagePb.getReadRatioAvg());
builder.readRatioMax(stagePb.getReadRatioMax());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public class JobStatisticsTest {
private static final QueryStage QUERY_STAGE = QueryStage.builder()
.computeRatioAvg(1.1)
.computeRatioMax(2.2)
.id(42L)
.generatedId(42L)
.name("stage")
.readRatioAvg(3.3)
.readRatioMax(4.4)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class QueryStageTest {
private static final QueryStage QUERY_STAGE = QueryStage.builder()
.computeRatioAvg(COMPUTE_RATIO_AVG)
.computeRatioMax(COMPUTE_RATIO_MAX)
.id(ID)
.generatedId(ID)
.name(NAME)
.readRatioAvg(READ_RATIO_AVG)
.readRatioMax(READ_RATIO_MAX)
Expand All @@ -73,7 +73,7 @@ public void testQueryStepConstructor() {
public void testBuilder() {
assertEquals(COMPUTE_RATIO_AVG, QUERY_STAGE.computeRatioAvg(), 0);
assertEquals(COMPUTE_RATIO_MAX, QUERY_STAGE.computeRatioMax(), 0);
assertEquals(ID, QUERY_STAGE.id());
assertEquals(ID, QUERY_STAGE.generatedId());
assertEquals(NAME, QUERY_STAGE.name());
assertEquals(READ_RATIO_AVG, QUERY_STAGE.readRatioAvg(), 0);
assertEquals(READ_RATIO_MAX, QUERY_STAGE.readRatioMax(), 0);
Expand Down Expand Up @@ -108,7 +108,7 @@ private void compareQueryStage(QueryStage expected, QueryStage value) {
assertEquals(expected, value);
assertEquals(expected.computeRatioAvg(), value.computeRatioAvg(), 0);
assertEquals(expected.computeRatioMax(), value.computeRatioMax(), 0);
assertEquals(expected.id(), value.id());
assertEquals(expected.generatedId(), value.generatedId());
assertEquals(expected.name(), value.name());
assertEquals(expected.readRatioAvg(), value.readRatioAvg(), 0);
assertEquals(expected.readRatioMax(), value.readRatioMax(), 0);
Expand Down

0 comments on commit 0849646

Please sign in to comment.