Skip to content

Commit

Permalink
fix: NPE issue with testMultipleRuns (#2050)
Browse files Browse the repository at this point in the history
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 ☕️
  • Loading branch information
prash-mi committed May 18, 2022
1 parent bf77967 commit 251d468
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -234,8 +234,10 @@ public BigQueryResult executeSelect(
BigQueryResult getResultSet(
GetQueryResultsResponse firstPage, JobId jobId, String sql, Boolean hasQueryParameters) {
if (firstPage.getJobComplete()
&& firstPage.getTotalRows()
!= null) { // firstPage.getTotalRows() is null if job is not complete
&& firstPage.getTotalRows() != null
&& firstPage.getSchema()
!= null) { // firstPage.getTotalRows() is null if job is not complete. We need to make
// sure that the schema is not null, as it is required for the ResultSet
return getSubsequentQueryResultsWithJob(
firstPage.getTotalRows().longValue(),
(long) firstPage.getRows().size(),
Expand Down

0 comments on commit 251d468

Please sign in to comment.