Skip to content

Why StandardSQLTypeName.ARRAY doesn't work? #1800

@haikuo-google

Description

@haikuo-google

Environment details

I am using client version 2.6.1 from MVN: https://mvnrepository.com/artifact/com.google.cloud/google-cloud-bigquery/2.6.1

Steps to reproduce

Please simply run the code example below.

Code example

Field.newBuilder("abc", StandardSQLTypeName.ARRAY).build();

Stack trace

java.lang.NullPointerException
    at com.google.common.base.Preconditions.checkNotNull (Preconditions.java:878)
    at com.google.cloud.bigquery.Field.<init> (Field.java:256)
    at com.google.cloud.bigquery.Field.<init> (Field.java:37)
    at com.google.cloud.bigquery.Field$Builder.build (Field.java:250)
    at com.google.changestreams.sample.bigquery.BigQueryClientTesting.main (BigQueryClientTesting.java:14)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:254)
    at java.lang.Thread.run (Thread.java:829)

Any additional information below

It looks like the client is always trying to convert the Field type from StandardSQLTypeName to LegacySQLTypeName, but there isn't an ARRAY in LegacySQLTypeName, causing the type to be null, which shouldn't be. How do we specify ARRAY type then?

public Builder setType(StandardSQLTypeName type, FieldList subFields) {

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