From 883c60eff3f38413ca4187722233c599378e6de2 Mon Sep 17 00:00:00 2001 From: Ajay Kannan Date: Fri, 1 Apr 2016 13:43:05 -0700 Subject: [PATCH] rename QueryStage id to generatedId --- .../google/gcloud/bigquery/QueryStage.java | 26 +++++++++---------- .../gcloud/bigquery/JobStatisticsTest.java | 2 +- .../gcloud/bigquery/QueryStageTest.java | 6 ++--- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/QueryStage.java b/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/QueryStage.java index 8c9f91fd39f3..9404fbf5d9ad 100644 --- a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/QueryStage.java +++ b/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/QueryStage.java @@ -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; @@ -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; @@ -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; } @@ -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; @@ -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; } /** @@ -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) @@ -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); } @@ -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 @@ -406,7 +406,7 @@ ExplainQueryStage toPb() { ExplainQueryStage stagePb = new ExplainQueryStage() .setComputeRatioAvg(computeRatioAvg) .setComputeRatioMax(computeRatioMax) - .setId(id) + .setId(generatedId) .setName(name) .setReadRatioAvg(readRatioAvg) .setReadRatioMax(readRatioMax) @@ -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()); diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/JobStatisticsTest.java b/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/JobStatisticsTest.java index 1ec67d034754..4a3940ba4543 100644 --- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/JobStatisticsTest.java +++ b/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/JobStatisticsTest.java @@ -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) diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/QueryStageTest.java b/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/QueryStageTest.java index 99a7c8096454..ac60967a8bee 100644 --- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/QueryStageTest.java +++ b/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/QueryStageTest.java @@ -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) @@ -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); @@ -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);