-
Notifications
You must be signed in to change notification settings - Fork 129
Closed
Labels
api: bigqueryIssues related to the googleapis/java-bigquery API.Issues related to the googleapis/java-bigquery API.
Description
We get NPE when we read an empty table using Read API.
NPE happens here:
java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryResultImpl.java
Line 120 in 4061922
| cursor = buffer.take(); // advance the cursor,Potentially blocking operation |
When we run query Using Fast Query Path (Read API disabled) such code works fine.buffer.take() returns cursor and it correctly indicated in isEndOfStream as EndOfFieldValueList.
But when we enable Read API buffer.take() throws NPE since buffer is null.
Environment details
com.google.cloud:google-cloud-bigquery:2.45.0
Mac OS Sonoma M1
Java version: 17
Steps to reproduce
- Enable Read API (make sure you see
Not Using Fast Query Path, using jobs.insert, see related issue I've attached) - Read the empty table
- Execute next()
Code example
val connectionSettings = ConnectionSettings.newBuilder()
.setJobTimeoutMs(Long.MAX_VALUE) // that is crucial to enable Read API, see the attached issue
.setRequestTimeout(DEFAULT_QUERY_TIMEOUT_MS)
.setUseReadAPI(true)
.setMaxResults(DEFAULT_MAX_RESULT)
.setUseQueryCache(true)
.build()
val connection = context.createConnection(connectionSettings)
val bqResult = connection.executeSelect(code)
bqResult.resultSet.next() // NPE
Stack trace
onError(java.lang.NullPointerException: Cannot invoke "java.util.concurrent.BlockingQueue.take()" because the return value of "com.google.cloud.bigquery.BigQueryResultImpl.access$200(com.google.cloud.bigquery.BigQueryResultImpl)" is null))
at com.google.cloud.bigquery.BigQueryResultImpl$BigQueryResultSet.next(BigQueryResultImpl.java:120)
Related issue: googleapis/java-bigquerystorage#2764
#3624
Metadata
Metadata
Assignees
Labels
api: bigqueryIssues related to the googleapis/java-bigquery API.Issues related to the googleapis/java-bigquery API.