From 25698a16cd4ede387866683e358228eb5fbd54cd Mon Sep 17 00:00:00 2001 From: Phong Chuong <147636638+PhongChuong@users.noreply.github.com> Date: Fri, 2 Feb 2024 23:07:51 -0500 Subject: [PATCH 1/6] Feat: Add MetadataCacheStatistics to Job QueryStatistics --- .../google/cloud/bigquery/JobStatistics.java | 25 ++++ .../cloud/bigquery/MetadataCacheStats.java | 72 +++++++++++ .../bigquery/TableMetadataCacheUsage.java | 118 ++++++++++++++++++ .../src/test/java/MetadataCacheStatsTest.java | 60 +++++++++ .../cloud/bigquery/JobStatisticsTest.java | 11 ++ .../bigquery/TableMetadataCacheUsageTest.java | 70 +++++++++++ 6 files changed, 356 insertions(+) create mode 100644 google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/MetadataCacheStats.java create mode 100644 google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableMetadataCacheUsage.java create mode 100644 google-cloud-bigquery/src/test/java/MetadataCacheStatsTest.java create mode 100644 google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/TableMetadataCacheUsageTest.java diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/JobStatistics.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/JobStatistics.java index 1cbf22fa7..d5f0ebb65 100644 --- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/JobStatistics.java +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/JobStatistics.java @@ -358,6 +358,9 @@ public static class QueryStatistics extends JobStatistics { private final List timeline; private final Schema schema; private final SearchStats searchStats; + + private final MetadataCacheStats metadataCacheStats; + private final List queryParameters; /** @@ -444,6 +447,8 @@ static final class Builder extends JobStatistics.Builder queryParameters; private SearchStats searchStats; + private MetadataCacheStats metadataCacheStats; + private Builder() {} private Builder(com.google.api.services.bigquery.model.JobStatistics statisticsPb) { @@ -493,6 +498,10 @@ private Builder(com.google.api.services.bigquery.model.JobStatistics statisticsP if (statisticsPb.getQuery().getSearchStatistics() != null) { this.searchStats = SearchStats.fromPb(statisticsPb.getQuery().getSearchStatistics()); } + if (statisticsPb.getQuery().getMetadataCacheStatistics() != null) { + this.metadataCacheStats = + MetadataCacheStats.fromPb(statisticsPb.getQuery().getMetadataCacheStatistics()); + } if (statisticsPb.getQuery().getDmlStats() != null) { this.dmlStats = DmlStats.fromPb(statisticsPb.getQuery().getDmlStats()); } @@ -599,6 +608,11 @@ Builder setSearchStats(SearchStats searchStats) { return self(); } + Builder setMetadataCacheStats(MetadataCacheStats metadataCacheStats) { + this.metadataCacheStats = metadataCacheStats; + return self(); + } + Builder setQueryParameters(List queryParameters) { this.queryParameters = queryParameters; return self(); @@ -631,6 +645,7 @@ private QueryStatistics(Builder builder) { this.timeline = builder.timeline; this.schema = builder.schema; this.searchStats = builder.searchStats; + this.metadataCacheStats = builder.metadataCacheStats; this.queryParameters = builder.queryParameters; } @@ -761,6 +776,11 @@ public SearchStats getSearchStats() { return searchStats; } + /** Statistics for metadata caching in BigLake tables. */ + public MetadataCacheStats getMetadataCacheStats() { + return metadataCacheStats; + } + /** * Standard SQL only: Returns a list of undeclared query parameters detected during a dry run * validation. @@ -781,6 +801,7 @@ ToStringHelper toStringHelper() { .add("timeline", timeline) .add("schema", schema) .add("searchStats", searchStats) + .add("metadataCacheStats", metadataCacheStats) .add("queryParameters", queryParameters); } @@ -804,6 +825,7 @@ public final int hashCode() { queryPlan, schema, searchStats, + metadataCacheStats, queryParameters); } @@ -849,6 +871,9 @@ com.google.api.services.bigquery.model.JobStatistics toPb() { if (searchStats != null) { queryStatisticsPb.setSearchStatistics(searchStats.toPb()); } + if (metadataCacheStats != null) { + queryStatisticsPb.setMetadataCacheStatistics(metadataCacheStats.toPb()); + } if (queryParameters != null) { queryStatisticsPb.setUndeclaredQueryParameters(queryParameters); } diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/MetadataCacheStats.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/MetadataCacheStats.java new file mode 100644 index 000000000..db41f41a1 --- /dev/null +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/MetadataCacheStats.java @@ -0,0 +1,72 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *e + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.bigquery; + +import com.google.api.services.bigquery.model.MetadataCacheStatistics; +import com.google.auto.value.AutoValue; +import java.io.Serializable; +import java.util.List; +import java.util.stream.Collectors; +import javax.annotation.Nullable; + +/** Represents statistics for metadata caching in BigLake tables. */ +@AutoValue +public abstract class MetadataCacheStats implements Serializable { + + private static final long serialVersionUID = 1L; + + @AutoValue.Builder + public abstract static class Builder { + /** Sets the free form human-readable reason metadata caching was unused for the job. */ + public abstract MetadataCacheStats.Builder setTableMetadataCacheUsage( + List tableMetadataCacheUsage); + + /** Creates a @code MetadataCacheStats} object. */ + public abstract MetadataCacheStats build(); + } + + public abstract Builder toBuilder(); + + public static Builder newBuilder() { + return new AutoValue_MetadataCacheStats.Builder(); + } + + @Nullable + public abstract List getTableMetadataCacheUsage(); + + MetadataCacheStatistics toPb() { + MetadataCacheStatistics metadataCacheStatistics = new MetadataCacheStatistics(); + if (getTableMetadataCacheUsage() != null) { + metadataCacheStatistics.setTableMetadataCacheUsage( + getTableMetadataCacheUsage().stream() + .map(TableMetadataCacheUsage::toPb) + .collect(Collectors.toList())); + } + return metadataCacheStatistics; + } + + static MetadataCacheStats fromPb(MetadataCacheStatistics metadataCacheStatistics) { + Builder builder = newBuilder(); + if (metadataCacheStatistics.getTableMetadataCacheUsage() != null) { + builder.setTableMetadataCacheUsage( + metadataCacheStatistics.getTableMetadataCacheUsage().stream() + .map(TableMetadataCacheUsage::fromPb) + .collect(Collectors.toList())); + } + return builder.build(); + } +} diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableMetadataCacheUsage.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableMetadataCacheUsage.java new file mode 100644 index 000000000..89ad4f966 --- /dev/null +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableMetadataCacheUsage.java @@ -0,0 +1,118 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.bigquery; + +import com.google.auto.value.AutoValue; +import java.io.Serializable; +import javax.annotation.Nullable; + +/** Represents Table level detail on the usage of metadata caching. */ +@AutoValue +public abstract class TableMetadataCacheUsage implements Serializable { + + private static final long serialVersionUID = 1L; + + /** Reason for not using metadata caching for the table. */ + public enum UnusedReason { + /** Unused reasons not specified. */ + UNUSED_REASON_UNSPECIFIED, + + /** Metadata cache was outside the table's maxStaleness. */ + EXCEEDED_MAX_STALENESS, + + /** + * Metadata caching feature is not enabled. Update BigLake tables to enable the metadata + * caching. + */ + METADATA_CACHING_NOT_ENABLED, + + /** Other unknown reason. */ + OTHER_REASON + } + + @AutoValue.Builder + public abstract static class Builder { + /** Sets the free form human-readable reason metadata caching was unused for the job. */ + public abstract TableMetadataCacheUsage.Builder setExplanation(String explanation); + + /** Sets the metadata caching eligible table referenced in the query. */ + public abstract TableMetadataCacheUsage.Builder setTableReference(TableId tableReference); + + /** Sets the table type. */ + public abstract TableMetadataCacheUsage.Builder setTableType(String tableType); + + /** Sets reason for not using metadata caching for the table. */ + public abstract TableMetadataCacheUsage.Builder setUnusedReason(UnusedReason unusedReason); + + /** Creates a @code TableMetadataCacheUsage} object. */ + public abstract TableMetadataCacheUsage build(); + } + + public abstract Builder toBuilder(); + + public static Builder newBuilder() { + return new AutoValue_TableMetadataCacheUsage.Builder(); + } + + @Nullable + public abstract String getExplanation(); + + @Nullable + public abstract TableId getTableReference(); + + @Nullable + public abstract String getTableType(); + + @Nullable + public abstract UnusedReason getUnusedReason(); + + com.google.api.services.bigquery.model.TableMetadataCacheUsage toPb() { + com.google.api.services.bigquery.model.TableMetadataCacheUsage tableMetadataCacheUsage = + new com.google.api.services.bigquery.model.TableMetadataCacheUsage(); + if (getExplanation() != null) { + tableMetadataCacheUsage.setExplanation(getExplanation()); + } + if (getTableReference() != null) { + tableMetadataCacheUsage.setTableReference(getTableReference().toPb()); + } + if (getTableType() != null) { + tableMetadataCacheUsage.setTableType(getTableType()); + } + if (getUnusedReason() != null) { + tableMetadataCacheUsage.setUnusedReason(getUnusedReason().toString()); + } + return tableMetadataCacheUsage; + } + + static TableMetadataCacheUsage fromPb( + com.google.api.services.bigquery.model.TableMetadataCacheUsage tableMetadataCacheUsage) { + Builder builder = newBuilder(); + if (tableMetadataCacheUsage.getExplanation() != null) { + builder.setExplanation(tableMetadataCacheUsage.getExplanation()); + } + if (tableMetadataCacheUsage.getTableReference() != null) { + builder.setTableReference(TableId.fromPb(tableMetadataCacheUsage.getTableReference())); + } + if (tableMetadataCacheUsage.getTableType() != null) { + builder.setTableType(tableMetadataCacheUsage.getTableType()); + } + if (tableMetadataCacheUsage.getUnusedReason() != null) { + builder.setUnusedReason(UnusedReason.valueOf(tableMetadataCacheUsage.getUnusedReason())); + } + return builder.build(); + } +} diff --git a/google-cloud-bigquery/src/test/java/MetadataCacheStatsTest.java b/google-cloud-bigquery/src/test/java/MetadataCacheStatsTest.java new file mode 100644 index 000000000..d1cfa86e9 --- /dev/null +++ b/google-cloud-bigquery/src/test/java/MetadataCacheStatsTest.java @@ -0,0 +1,60 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.bigquery; + +import static org.junit.Assert.assertEquals; + +import com.google.api.services.bigquery.model.MetadataCacheStatistics; +import com.google.common.collect.ImmutableList; +import com.google.common.truth.Truth; +import java.util.List; +import java.util.stream.Collectors; +import org.junit.Test; + +public class MetadataCacheStatsTest { + private static List + TABLE_METADATA_CACHE_USAGE_PB_LIST = + ImmutableList.of( + new com.google.api.services.bigquery.model.TableMetadataCacheUsage() + .setExplanation("test explanation")); + + private static final MetadataCacheStats METADATA_CACHE_STATS = + MetadataCacheStats.newBuilder() + .setTableMetadataCacheUsage( + TABLE_METADATA_CACHE_USAGE_PB_LIST.stream() + .map(TableMetadataCacheUsage::fromPb) + .collect(Collectors.toList())) + .build(); + + private static final MetadataCacheStatistics METADATA_CACHE_STATISTICS_PB = + new MetadataCacheStatistics().setTableMetadataCacheUsage(TABLE_METADATA_CACHE_USAGE_PB_LIST); + + @Test + public void testToPbAndFromPb() { + assertEquals(METADATA_CACHE_STATISTICS_PB, METADATA_CACHE_STATS.toPb()); + compareMetadataCacheStats( + METADATA_CACHE_STATS, MetadataCacheStats.fromPb(METADATA_CACHE_STATISTICS_PB)); + } + + private void compareMetadataCacheStats(MetadataCacheStats expected, MetadataCacheStats value) { + assertEquals(expected, value); + assertEquals(expected.hashCode(), value.hashCode()); + assertEquals(expected.toString(), value.toString()); + Truth.assertThat( + expected.getTableMetadataCacheUsage().containsAll(value.getTableMetadataCacheUsage())); + } +} diff --git a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/JobStatisticsTest.java b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/JobStatisticsTest.java index f32832b59..5502b8472 100644 --- a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/JobStatisticsTest.java +++ b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/JobStatisticsTest.java @@ -163,6 +163,14 @@ public class JobStatisticsTest { private static final String UNUSED_INDEX_USAGE_MODE = "UNUSED"; private static final SearchStats SEARCH_STATS = SearchStats.newBuilder().setIndexUsageMode(UNUSED_INDEX_USAGE_MODE).build(); + + private static final MetadataCacheStats METADATA_CACHE_STATS = + MetadataCacheStats.newBuilder() + .setTableMetadataCacheUsage( + ImmutableList.of( + TableMetadataCacheUsage.newBuilder().setExplanation("test explanation").build())) + .build(); + private static final QueryStatistics QUERY_STATISTICS = QueryStatistics.newBuilder() .setCreationTimestamp(CREATION_TIME) @@ -187,6 +195,7 @@ public class JobStatisticsTest { .setTimeline(TIMELINE) .setSchema(SCHEMA) .setSearchStats(SEARCH_STATS) + .setMetadataCacheStats(METADATA_CACHE_STATS) .build(); private static final QueryStatistics QUERY_STATISTICS_INCOMPLETE = QueryStatistics.newBuilder() @@ -196,6 +205,7 @@ public class JobStatisticsTest { .setBillingTier(BILLING_TIER) .setCacheHit(CACHE_HIT) .setSearchStats(SEARCH_STATS) + .setMetadataCacheStats(METADATA_CACHE_STATS) .build(); private static final ScriptStackFrame STATEMENT_STACK_FRAME = ScriptStackFrame.newBuilder() @@ -417,6 +427,7 @@ private void compareQueryStatistics(QueryStatistics expected, QueryStatistics va assertEquals(expected.getSchema(), value.getSchema()); assertEquals( expected.getSearchStats().getIndexUsageMode(), value.getSearchStats().getIndexUsageMode()); + assertEquals(expected.getMetadataCacheStats(), value.getMetadataCacheStats()); assertEquals(expected.getStatementType(), value.getStatementType()); assertEquals(expected.getTimeline(), value.getTimeline()); } diff --git a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/TableMetadataCacheUsageTest.java b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/TableMetadataCacheUsageTest.java new file mode 100644 index 000000000..8f141fa59 --- /dev/null +++ b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/TableMetadataCacheUsageTest.java @@ -0,0 +1,70 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.bigquery; + +import static org.junit.Assert.assertEquals; + +import com.google.api.services.bigquery.model.TableReference; +import com.google.cloud.bigquery.TableMetadataCacheUsage.UnusedReason; +import org.junit.Test; + +public class TableMetadataCacheUsageTest { + + private static final String EXPLANATION = "test explanation"; + + private static final String TABLE_TYPE = "test tableType"; + + private static final UnusedReason UNUSED_REASON = UnusedReason.UNUSED_REASON_UNSPECIFIED; + private static final TableReference TABLE_REFERENCE = + new TableReference() + .setTableId("test tableId") + .setProjectId("test projectId") + .setDatasetId("test dataset"); + private static final TableMetadataCacheUsage TABLE_METADATA_CACHE_USAGE = + TableMetadataCacheUsage.newBuilder() + .setExplanation(EXPLANATION) + .setTableType(TABLE_TYPE) + .setUnusedReason(UNUSED_REASON) + .setTableReference(TableId.fromPb(TABLE_REFERENCE)) + .build(); + + private static final com.google.api.services.bigquery.model.TableMetadataCacheUsage + TABLE_METADATA_CACHE_USAGE_PB = + new com.google.api.services.bigquery.model.TableMetadataCacheUsage() + .setTableReference(TABLE_REFERENCE) + .setExplanation(EXPLANATION) + .setTableType(TABLE_TYPE) + .setUnusedReason(UNUSED_REASON.toString()); + + @Test + public void testToPbAndFromPb() { + assertEquals(TABLE_METADATA_CACHE_USAGE_PB, TABLE_METADATA_CACHE_USAGE.toPb()); + compareTableMetadataCacheUsage( + TABLE_METADATA_CACHE_USAGE, TableMetadataCacheUsage.fromPb(TABLE_METADATA_CACHE_USAGE_PB)); + } + + private void compareTableMetadataCacheUsage( + TableMetadataCacheUsage expected, TableMetadataCacheUsage value) { + assertEquals(expected, value); + assertEquals(expected.hashCode(), value.hashCode()); + assertEquals(expected.toString(), value.toString()); + assertEquals(expected.getExplanation(), value.getExplanation()); + assertEquals(expected.getTableType(), value.getTableType()); + assertEquals(expected.getUnusedReason(), value.getUnusedReason()); + assertEquals(expected.getTableReference(), value.getTableReference()); + } +} From fdb9ce0937810451bbad1ebcc6e34ab8e7f68218 Mon Sep 17 00:00:00 2001 From: Phong Chuong <147636638+PhongChuong@users.noreply.github.com> Date: Fri, 9 Feb 2024 15:08:37 -0500 Subject: [PATCH 2/6] Add integration test --- .../cloud/bigquery/MetadataCacheStats.java | 2 +- .../cloud/bigquery/it/ITBigQueryTest.java | 44 ++++++++++++++++++- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/MetadataCacheStats.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/MetadataCacheStats.java index db41f41a1..8da96d5f1 100644 --- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/MetadataCacheStats.java +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/MetadataCacheStats.java @@ -4,7 +4,7 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - *e + * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software diff --git a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java index ba30ea0d4..c18b62ee8 100644 --- a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java +++ b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java @@ -125,6 +125,7 @@ import com.google.cloud.bigquery.TableDefinition; import com.google.cloud.bigquery.TableId; import com.google.cloud.bigquery.TableInfo; +import com.google.cloud.bigquery.TableMetadataCacheUsage.UnusedReason; import com.google.cloud.bigquery.TableResult; import com.google.cloud.bigquery.TimePartitioning; import com.google.cloud.bigquery.TimePartitioning.Type; @@ -1881,7 +1882,7 @@ public void testCreateExternalTable() throws InterruptedException { rowCount++; } assertEquals(4, rowCount); - assertTrue(remoteTable.delete()); + // assertTrue(remoteTable.delete()); } @Test @@ -6448,6 +6449,47 @@ public void testUniverseDomainWithMatchingDomain() { } } + @Test + public void testExternalTableMetadataCachingNotEnable() throws InterruptedException { + String tableName = "test_metadata_cache_not_enable"; + TableId tableId = TableId.of(DATASET, tableName); + ExternalTableDefinition externalTableDefinition = + ExternalTableDefinition.of( + "gs://" + BUCKET + "/" + JSON_LOAD_FILE, TABLE_SCHEMA, FormatOptions.json()); + TableInfo tableInfo = TableInfo.of(tableId, externalTableDefinition); + Table createdTable = bigquery.create(tableInfo); + assertNotNull(createdTable); + assertEquals(DATASET, createdTable.getTableId().getDataset()); + assertEquals(tableName, createdTable.getTableId().getTable()); + Table remoteTable = bigquery.getTable(DATASET, tableName); + assertNotNull(remoteTable); + assertTrue(remoteTable.getDefinition() instanceof ExternalTableDefinition); + assertEquals(createdTable.getTableId(), remoteTable.getTableId()); + assertEquals(TABLE_SCHEMA, remoteTable.getDefinition().getSchema()); + + String query = String.format("SELECT * FROM %s.%s", DATASET, tableName); + QueryJobConfiguration config = QueryJobConfiguration.newBuilder(query).build(); + + Job remoteJob = bigquery.create(JobInfo.of(config)); + remoteJob = remoteJob.waitFor(); + assertNull(remoteJob.getStatus().getError()); + + Job queryJob = bigquery.getJob(remoteJob.getJobId()); + JobStatistics.QueryStatistics statistics = queryJob.getStatistics(); + assertNotNull(statistics); + assertNotNull(statistics.getMetadataCacheStats()); + assertThat(statistics.getMetadataCacheStats().getTableMetadataCacheUsage().size()).isEqualTo(1); + assertThat( + statistics + .getMetadataCacheStats() + .getTableMetadataCacheUsage() + .get(0) + .getUnusedReason()) + .isEqualTo(UnusedReason.METADATA_CACHING_NOT_ENABLED); + + assertTrue(remoteTable.delete()); + } + static GoogleCredentials loadCredentials(String credentialFile) { try { InputStream keyStream = new ByteArrayInputStream(credentialFile.getBytes()); From 5df79bd25003e557c40afe08c69cf806f6eb2966 Mon Sep 17 00:00:00 2001 From: Phong Chuong <147636638+PhongChuong@users.noreply.github.com> Date: Fri, 9 Feb 2024 15:12:44 -0500 Subject: [PATCH 3/6] Add integration test --- .../src/main/java/com/google/cloud/bigquery/JobStatistics.java | 2 -- .../test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/JobStatistics.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/JobStatistics.java index d5f0ebb65..5979afbca 100644 --- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/JobStatistics.java +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/JobStatistics.java @@ -358,9 +358,7 @@ public static class QueryStatistics extends JobStatistics { private final List timeline; private final Schema schema; private final SearchStats searchStats; - private final MetadataCacheStats metadataCacheStats; - private final List queryParameters; /** diff --git a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java index c18b62ee8..e5af001a4 100644 --- a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java +++ b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java @@ -1882,7 +1882,7 @@ public void testCreateExternalTable() throws InterruptedException { rowCount++; } assertEquals(4, rowCount); - // assertTrue(remoteTable.delete()); + assertTrue(remoteTable.delete()); } @Test From e72e290b79748c068372706d3c9affddf452730c Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 9 Feb 2024 20:22:10 +0000 Subject: [PATCH 4/6] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4705d64a0..f26b3e589 100644 --- a/README.md +++ b/README.md @@ -60,13 +60,13 @@ implementation 'com.google.cloud:google-cloud-bigquery' If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-bigquery:2.37.0' +implementation 'com.google.cloud:google-cloud-bigquery:2.37.1' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "2.37.0" +libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "2.37.1" ``` @@ -351,7 +351,7 @@ Java is a registered trademark of Oracle and/or its affiliates. [kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-bigquery/java11.html [stability-image]: https://img.shields.io/badge/stability-stable-green [maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-bigquery.svg -[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-bigquery/2.37.0 +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-bigquery/2.37.1 [authentication]: https://github.com/googleapis/google-cloud-java#authentication [auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes [predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles From 8b4e7cbf737a8b6f845fb16c7dbea8aedd500339 Mon Sep 17 00:00:00 2001 From: Phong Chuong <147636638+PhongChuong@users.noreply.github.com> Date: Wed, 14 Feb 2024 15:39:53 -0500 Subject: [PATCH 5/6] Update documentation. --- .../java/com/google/cloud/bigquery/MetadataCacheStats.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/MetadataCacheStats.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/MetadataCacheStats.java index 8da96d5f1..482571d5f 100644 --- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/MetadataCacheStats.java +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/MetadataCacheStats.java @@ -23,7 +23,11 @@ import java.util.stream.Collectors; import javax.annotation.Nullable; -/** Represents statistics for metadata caching in BigLake tables. */ +/** + * Represents statistics for metadata caching in BigLake tables. + * + * @see BigLake Tables + */ @AutoValue public abstract class MetadataCacheStats implements Serializable { From 0af192662b671813d5a247928722845ba4867252 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 14 Feb 2024 20:42:47 +0000 Subject: [PATCH 6/6] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f26b3e589..4d3abaa1a 100644 --- a/README.md +++ b/README.md @@ -53,20 +53,20 @@ If you are using Maven without the BOM, add this to your dependencies: If you are using Gradle 5.x or later, add this to your dependencies: ```Groovy -implementation platform('com.google.cloud:libraries-bom:26.31.0') +implementation platform('com.google.cloud:libraries-bom:26.32.0') implementation 'com.google.cloud:google-cloud-bigquery' ``` If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-bigquery:2.37.1' +implementation 'com.google.cloud:google-cloud-bigquery:2.37.2' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "2.37.1" +libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "2.37.2" ``` @@ -351,7 +351,7 @@ Java is a registered trademark of Oracle and/or its affiliates. [kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-bigquery/java11.html [stability-image]: https://img.shields.io/badge/stability-stable-green [maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-bigquery.svg -[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-bigquery/2.37.1 +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-bigquery/2.37.2 [authentication]: https://github.com/googleapis/google-cloud-java#authentication [auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes [predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles