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

fix: SearchStats IndexUnusedReasons null bug #2825

Merged
merged 3 commits into from Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -68,7 +68,7 @@ SearchStatistics toPb() {
searchStatistics.setIndexUsageMode(getIndexUsageMode());
}
if (getIndexUnusedReasons() != null) {
searchStatistics.setIndexUnusedReason(
searchStatistics.setIndexUnusedReasons(
getIndexUnusedReasons().stream()
.map(IndexUnusedReason::toPb)
.collect(Collectors.toList()));
Expand All @@ -81,9 +81,9 @@ static SearchStats fromPb(SearchStatistics searchStatistics) {
if (searchStatistics.getIndexUsageMode() != null) {
builder.setIndexUsageMode(searchStatistics.getIndexUsageMode());
}
if (searchStatistics.getIndexUnusedReason() != null) {
if (searchStatistics.getIndexUnusedReasons() != null) {
builder.setIndexUnusedReasons(
searchStatistics.getIndexUnusedReason().stream()
searchStatistics.getIndexUnusedReasons().stream()
.map(IndexUnusedReason::fromPb)
.collect(Collectors.toList()));
}
Expand Down
Expand Up @@ -5090,7 +5090,7 @@ public void testQueryJobWithLabels() throws InterruptedException, TimeoutExcepti
}

@Test
public void testQueryJobWithSearchReturnsSearchStatistics() throws InterruptedException {
public void testQueryJobWithSearchReturnsSearchStatisticsUnused() throws InterruptedException {
String tableName = "test_query_job_table";
String query =
"SELECT * FROM "
Expand All @@ -5109,6 +5109,10 @@ public void testQueryJobWithSearchReturnsSearchStatistics() throws InterruptedEx
JobStatistics.QueryStatistics stats = remoteJob.getStatistics();
assertNotNull(stats.getSearchStats());
assertEquals(stats.getSearchStats().getIndexUsageMode(), "UNUSED");
assertNotNull(stats.getSearchStats().getIndexUnusedReasons());
assertNotNull(
stats.getSearchStats().getIndexUnusedReasons().get(0).getCode(),
"INDEX_CONFIG_NOT_AVAILABLE");
} finally {
bigquery.delete(destinationTable);
}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -54,7 +54,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<github.global.server>github</github.global.server>
<site.installationModule>google-cloud-bigquery-parent</site.installationModule>
<google-api-services-bigquery.version>v2-rev20230520-2.0.0</google-api-services-bigquery.version>
<google-api-services-bigquery.version>v2-rev20230805-2.0.0</google-api-services-bigquery.version>
<google.cloud.shared-dependencies.version>3.14.0</google.cloud.shared-dependencies.version>
<arrow.version>12.0.1</arrow.version>
</properties>
Expand Down