Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Java client BigQuery.getTable returns a table with null schema when the table has no field #2477

Copy link
Copy link

Description

@cakraww
Issue body actions

To reproduce,

  1. Create an empty BigQuery table without any field on its schema. Let's say it's table "tableA" on dataset "dataset1".
  2. Running this code fails the assertion.
    BigQuery bigQuery = BigQueryOptions.getDefaultInstance().getService();
    Table table = bigQuery.getTable("dataset1", "tableA");
    Assert.assertNotNull(table.getDefinition().getSchema());

Is this expected behavior? Because we in fact can't create a TableDefinition with null schema as it's null-checked in com.google.cloud.bigquery.TableDefinition.Builder.

    /**
     * Sets the table schema.
     */
    public B setSchema(Schema schema) {
      this.schema = checkNotNull(schema);
      return self();
    }

I think BigQuery.getTable on a table with empty schema should return a Schema instance with no field within its TableDefinition.

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the BigQuery API.Issues related to the BigQuery API.

Type

No type
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

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.