Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.
This repository was archived by the owner on Mar 23, 2026. It is now read-only.

BigQuery Java API: NPE on com.google.cloud.bigquery.StandardTableDefinition.fromPb(StandardTableDefinition.java:298) #296

Description

@chetanmeda

Environment details

  1. Specify the API at the beginning of the title (for example, "BigQuery: ...") : BigQuery
    General, Core, and Other are also allowed as types
  2. OS type and version: Any OS
  3. Java version: 1.8
  4. google-cloud-java version(s):
    com.google.cloud
    google-cloud-bigquery
    1.110.0

Steps to reproduce

NOT ABLE TO REPRODUCE

Code example

Page<Table> tables = bigquery.listTables(datasetId, BigQuery.TableListOption.pageSize(1));
Iterable<Table> table_iterator = tables.iterateAll();
for (Table table : table_iterator){
if (table.getDefinition().getType().toString().equalsIgnoreCase("TABLE")) {
                                           System.out.println("table");
                                        }
}

Stack trace

Caused by: java.lang.NullPointerException: Null pointer - Got unexpected time partitioning {"field":"XXXXX"} in project XXXXXX in dataset XXXXX in table XXXXX java.lang.NullPointerException: Name is null
        at com.google.cloud.bigquery.StandardTableDefinition.fromPb(StandardTableDefinition.java:298)
        at com.google.cloud.bigquery.TableDefinition.fromPb(TableDefinition.java:151)
        at com.google.cloud.bigquery.TableInfo$BuilderImpl.<init>(TableInfo.java:188)
        at com.google.cloud.bigquery.Table.fromPb(Table.java:624)
        at com.google.cloud.bigquery.BigQueryImpl$21.apply(BigQueryImpl.java:847)
        at com.google.cloud.bigquery.BigQueryImpl$21.apply(BigQueryImpl.java:844)
        at com.google.common.collect.Iterators$6.transform(Iterators.java:786)
        at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:47)
        at com.google.cloud.PageImpl$PageIterator.computeNext(PageImpl.java:72)
        at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:141)
        at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:136)

Any additional information below

This issue occurs on a few tables in Prod which I am not able to replicate in Dev.
The rpc call has the partition type as null but the TimePartitioning object in the response pb is not null which is leading to an NPE at this point.

builder.setTimePartitioning(TimePartitioning.fromPb(tablePb.getTimePartitioning()));

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

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions