diff --git a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/ExternalTableInfo.java b/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/ExternalTableInfo.java index 177f8a7db2b8..21ccb3fc1642 100644 --- a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/ExternalTableInfo.java +++ b/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/ExternalTableInfo.java @@ -21,6 +21,8 @@ import com.google.api.services.bigquery.model.Table; import com.google.common.base.MoreObjects.ToStringHelper; +import java.util.Objects; + /** * Google BigQuery External Table information. BigQuery's external tables are tables whose data * reside outside of BigQuery but can be queried as normal BigQuery tables. External tables are @@ -103,6 +105,17 @@ ToStringHelper toStringHelper() { return super.toStringHelper().add("configuration", configuration); } + @Override + public boolean equals(Object obj) { + return obj instanceof ExternalTableInfo + && Objects.equals(toPb(), ((ExternalTableInfo) obj).toPb()); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), configuration); + } + @Override Table toPb() { Table tablePb = super.toPb(); diff --git a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/TableInfo.java b/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/TableInfo.java index 05fb6908a51b..54258abc6ddd 100644 --- a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/TableInfo.java +++ b/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/TableInfo.java @@ -213,6 +213,16 @@ ToStringHelper toStringHelper() { .add("streamingBuffer", streamingBuffer); } + @Override + public boolean equals(Object obj) { + return obj instanceof TableInfo && Objects.equals(toPb(), ((TableInfo) obj).toPb()); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), location, streamingBuffer); + } + @Override Table toPb() { Table tablePb = super.toPb(); diff --git a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/ViewInfo.java b/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/ViewInfo.java index 771a7a679c11..9af9e9d7a08e 100644 --- a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/ViewInfo.java +++ b/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/ViewInfo.java @@ -25,6 +25,7 @@ import com.google.common.collect.Lists; import java.util.List; +import java.util.Objects; /** * Google BigQuery View Table information. BigQuery's views are logical views, not materialized @@ -143,6 +144,16 @@ ToStringHelper toStringHelper() { .add("userDefinedFunctions", userDefinedFunctions); } + @Override + public boolean equals(Object obj) { + return obj instanceof ViewInfo && Objects.equals(toPb(), ((ViewInfo) obj).toPb()); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), query, userDefinedFunctions); + } + @Override Table toPb() { Table tablePb = super.toPb();