Skip to content

Commit 251d468

Browse files
authored
fix: NPE issue with testMultipleRuns (#2050)
Added a `null` check for `firstPage.getSchema()` as we might get null schema when the job is long running (We get schema using dryRun in such cases) Fixes #2049 ☕️
1 parent bf77967 commit 251d468

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/ConnectionImpl.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,10 @@ public BigQueryResult executeSelect(
234234
BigQueryResult getResultSet(
235235
GetQueryResultsResponse firstPage, JobId jobId, String sql, Boolean hasQueryParameters) {
236236
if (firstPage.getJobComplete()
237-
&& firstPage.getTotalRows()
238-
!= null) { // firstPage.getTotalRows() is null if job is not complete
237+
&& firstPage.getTotalRows() != null
238+
&& firstPage.getSchema()
239+
!= null) { // firstPage.getTotalRows() is null if job is not complete. We need to make
240+
// sure that the schema is not null, as it is required for the ResultSet
239241
return getSubsequentQueryResultsWithJob(
240242
firstPage.getTotalRows().longValue(),
241243
(long) firstPage.getRows().size(),

0 commit comments

Comments
 (0)