Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename QueryStage id to generatedId #834

Merged
merged 1 commit into from
Apr 1, 2016
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 @@ -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