You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 23, 2026. It is now read-only.
Thanks for stopping by to let us know something could be better!
Environment details
Specify the API at the beginning of the title. For example, "BigQuery: ...").
General, Core, and Other are also allowed as types: Bigquery Java Client
OS type and version:
Java version: 17 adoptium
version(s): 2.19.2 and 2.20.0
Steps to reproduce
set setUseReadAPI(false) on ConnectionSettings before building a connection
run a query that takes more than 10 seconds using the com.google.cloud.bigquery.Connection query APIs.
Sample Code
Standard usage with query that takes longer than 10 seconds (falls out of the fast query path).
ConnectionSettings connectionSettings =
ConnectionSettings.newBuilder()
.setUseReadAPI(false)
.setRequestTimeout(10L)
.setMaxResults(100L)
.setUseQueryCache(true)
.build();
Connection connection = bigquery.createConnection(connectionSettings);
String selectQuery = "<query that takes a little while and moves past the initial jobs.query timeout";
ListenableFuture<ExecuteSelectResponse> executeSelectFuture = connection.executeSelectAsync(selectQuery, ...);
Stack trace
java.lang.NullPointerException: Cannot invoke "java.lang.Long.longValue()" because "totalRows" is null
at com.google.cloud.bigquery.ConnectionImpl.useReadAPI(ConnectionImpl.java:1220)
at com.google.cloud.bigquery.ConnectionImpl.getSubsequentQueryResultsWithJob(ConnectionImpl.java:844)
at com.google.cloud.bigquery.ConnectionImpl.queryRpc(ConnectionImpl.java:486)
at com.google.cloud.bigquery.ConnectionImpl.getExecuteSelectResponse(ConnectionImpl.java:236)
at com.google.cloud.bigquery.ConnectionImpl.executeSelect(ConnectionImpl.java:218)
at com.google.cloud.bigquery.ConnectionImpl.lambda$getExecuteSelectFuture$0(ConnectionImpl.java:305)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:131)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:74)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:82)
... 3 more
Moving that check inside the if statement below it (which I think should be safe because of the check at the beginning of the method for null AND readAPI = true) should fix it.
Following these steps guarantees the quickest resolution possible.
Thanks for stopping by to let us know something could be better!
Environment details
General, Core, and Other are also allowed as types: Bigquery Java Client
Steps to reproduce
com.google.cloud.bigquery.Connectionquery APIs.Sample Code
Standard usage with query that takes longer than 10 seconds (falls out of the fast query path).
Stack trace
Any additional information below
Looks like the exception is being thrown here: https://github.com/googleapis/java-bigquery/blob/v2.21.0/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/ConnectionImpl.java#L1220
Moving that check inside the if statement below it (which I think should be safe because of the check at the beginning of the method for null AND readAPI = true) should fix it.
Following these steps guarantees the quickest resolution possible.
Thanks!