Skip to content

Commit 309ea60

Browse files
fix: SearchStats IndexUnusedReasons null bug (#2825)
* fix: SearchStats IndexUnusedReasons null bug * πŸ¦‰ Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent f8e3da7 commit 309ea60

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

β€ŽREADME.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,20 @@ If you are using Maven without the BOM, add this to your dependencies:
5353
If you are using Gradle 5.x or later, add this to your dependencies:
5454

5555
```Groovy
56-
implementation platform('com.google.cloud:libraries-bom:26.21.0')
56+
implementation platform('com.google.cloud:libraries-bom:26.22.0')
5757
5858
implementation 'com.google.cloud:google-cloud-bigquery'
5959
```
6060
If you are using Gradle without BOM, add this to your dependencies:
6161

6262
```Groovy
63-
implementation 'com.google.cloud:google-cloud-bigquery:2.31.0'
63+
implementation 'com.google.cloud:google-cloud-bigquery:2.31.1'
6464
```
6565

6666
If you are using SBT, add this to your dependencies:
6767

6868
```Scala
69-
libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "2.31.0"
69+
libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "2.31.1"
7070
```
7171
<!-- {x-version-update-end} -->
7272

@@ -351,7 +351,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
351351
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-bigquery/java11.html
352352
[stability-image]: https://img.shields.io/badge/stability-stable-green
353353
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-bigquery.svg
354-
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-bigquery/2.31.0
354+
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-bigquery/2.31.1
355355
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
356356
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
357357
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles

β€Žgoogle-cloud-bigquery/src/main/java/com/google/cloud/bigquery/SearchStats.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ SearchStatistics toPb() {
6868
searchStatistics.setIndexUsageMode(getIndexUsageMode());
6969
}
7070
if (getIndexUnusedReasons() != null) {
71-
searchStatistics.setIndexUnusedReason(
71+
searchStatistics.setIndexUnusedReasons(
7272
getIndexUnusedReasons().stream()
7373
.map(IndexUnusedReason::toPb)
7474
.collect(Collectors.toList()));
@@ -81,9 +81,9 @@ static SearchStats fromPb(SearchStatistics searchStatistics) {
8181
if (searchStatistics.getIndexUsageMode() != null) {
8282
builder.setIndexUsageMode(searchStatistics.getIndexUsageMode());
8383
}
84-
if (searchStatistics.getIndexUnusedReason() != null) {
84+
if (searchStatistics.getIndexUnusedReasons() != null) {
8585
builder.setIndexUnusedReasons(
86-
searchStatistics.getIndexUnusedReason().stream()
86+
searchStatistics.getIndexUnusedReasons().stream()
8787
.map(IndexUnusedReason::fromPb)
8888
.collect(Collectors.toList()));
8989
}

β€Žgoogle-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5090,7 +5090,7 @@ public void testQueryJobWithLabels() throws InterruptedException, TimeoutExcepti
50905090
}
50915091

50925092
@Test
5093-
public void testQueryJobWithSearchReturnsSearchStatistics() throws InterruptedException {
5093+
public void testQueryJobWithSearchReturnsSearchStatisticsUnused() throws InterruptedException {
50945094
String tableName = "test_query_job_table";
50955095
String query =
50965096
"SELECT * FROM "
@@ -5109,6 +5109,10 @@ public void testQueryJobWithSearchReturnsSearchStatistics() throws InterruptedEx
51095109
JobStatistics.QueryStatistics stats = remoteJob.getStatistics();
51105110
assertNotNull(stats.getSearchStats());
51115111
assertEquals(stats.getSearchStats().getIndexUsageMode(), "UNUSED");
5112+
assertNotNull(stats.getSearchStats().getIndexUnusedReasons());
5113+
assertNotNull(
5114+
stats.getSearchStats().getIndexUnusedReasons().get(0).getCode(),
5115+
"INDEX_CONFIG_NOT_AVAILABLE");
51125116
} finally {
51135117
bigquery.delete(destinationTable);
51145118
}

β€Žpom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
5555
<github.global.server>github</github.global.server>
5656
<site.installationModule>google-cloud-bigquery-parent</site.installationModule>
57-
<google-api-services-bigquery.version>v2-rev20230520-2.0.0</google-api-services-bigquery.version>
57+
<google-api-services-bigquery.version>v2-rev20230805-2.0.0</google-api-services-bigquery.version>
5858
<google.cloud.shared-dependencies.version>3.14.0</google.cloud.shared-dependencies.version>
5959
<arrow.version>12.0.1</arrow.version>
6060
</properties>

0 commit comments

Comments
 (0)