Skip to content

BigQuery: NullPointerException while running com.google.cloud.bigquery.Job.getQueryResults #697

@otlg

Description

@otlg

Environment details

  1. BigQuery API
  2. OS type and version: MacOS 10.15.5
  3. Java version: 13.0.2
  4. bigquery version(s): group: 'com.google.cloud', name: 'google-cloud-bigquery', version: '1.116.10'

Steps to reproduce

  1. Create query:
    DECLARE ids_filter ARRAY default ["1"];
    SELECT TO_JSON_STRING(query)
    from (
    select * from TABLE
    WHERE row.id IN UNNEST(ids_filter)
    ) as query

  2. results = job.getQueryResults( --> throws NullPointerException
    BigQuery.QueryResultsOption.pageSize(10),
    BigQuery.QueryResultsOption.startIndex(0);
    );

Stack trace

java.lang.NullPointerException	at com.google.cloud.bigquery.BigQueryImpl.listTableData(BigQueryImpl.java:1021)	at com.google.cloud.bigquery.BigQueryImpl.listTableData(BigQueryImpl.java:1010)	at com.google.cloud.bigquery.Job.getQueryResults(Job.java:312) ............. 

Any additional information below

Due to DECLARE statement and before the following reload, the destination table is null.
Once the job is reloaded it does not override current (this) job

Job job = this; if (job.getStatus() == null || !JobStatus.State.DONE.equals(job.getStatus().getState())) { job = reload(); } 
 TableId table = ((QueryJobConfiguration) getConfiguration()).getDestinationTable(); 

and cause the crash later in listTableData while accessing tableId.getProject().

When DECLARE statement omitted, the query works OK, also, the response has relevant information responded by BigQuery.
In both cases, the destination table is not overridden but without DECLARE it is not null.

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the googleapis/java-bigquery API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions