Skip to content

BigQuery connection api with fast path disabled throws NPE for queries that return 0 rows #3441

@dspangen

Description

@dspangen

Environment details

  1. Specify the API at the beginning of the title. For example, "BigQuery: ...").
    General, Core, and Other are also allowed as types
  2. OS type and version: MacOS
  3. Java version: Temurin-21
  4. version(s): 2.42.0

Steps to reproduce

  1. You must use the connection api and ensure the fast path is disabled (setting a job timeout will ensure this)
  2. Your query must return no rows

Code example

bigQuery.createConnection(ConnectionSettings.newBuilder()
                        .setUseReadAPI(false)
                        .setJobTimeoutMs(10_000).build()).executeSelect("select * from (select 'blah' as col) where 1 = 0")

Relevant Stack trace

java.lang.NullPointerException: Cannot invoke "java.util.List.size()" because the return value of "com.google.api.services.bigquery.model.GetQueryResultsResponse.getRows()" is null
	at com.google.cloud.bigquery.ConnectionImpl.getResultSet(ConnectionImpl.java:423)
	at com.google.cloud.bigquery.ConnectionImpl.getExecuteSelectResponse(ConnectionImpl.java:247)
	at com.google.cloud.bigquery.ConnectionImpl.executeSelect(ConnectionImpl.java:198)
        .... user code ....

External references such as API reference guides

  • ?

Any additional information below

Following these steps guarantees the quickest resolution possible.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: bigqueryIssues related to the googleapis/java-bigquery API.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions