{"action":"closed","issue":{"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-java/issues/2477","repository_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-java","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-java/issues/2477/labels{/name}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-java/issues/2477/comments","events_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-java/issues/2477/events","html_url":"https://github.com/GoogleCloudPlatform/google-cloud-java/issues/2477","id":262652091,"number":2477,"title":"Java client BigQuery.getTable returns a table with null schema when the table has no field","user":{"login":"cakraww","id":4298417,"avatar_url":"https://avatars0.githubusercontent.com/u/4298417?v=4","gravatar_id":"","url":"https://api.github.com/users/cakraww","html_url":"https://github.com/cakraww","followers_url":"https://api.github.com/users/cakraww/followers","following_url":"https://api.github.com/users/cakraww/following{/other_user}","gists_url":"https://api.github.com/users/cakraww/gists{/gist_id}","starred_url":"https://api.github.com/users/cakraww/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cakraww/subscriptions","organizations_url":"https://api.github.com/users/cakraww/orgs","repos_url":"https://api.github.com/users/cakraww/repos","events_url":"https://api.github.com/users/cakraww/events{/privacy}","received_events_url":"https://api.github.com/users/cakraww/received_events","type":"User","site_admin":false},"labels":[{"id":175662171,"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-java/labels/API:%20bigquery","name":"API: bigquery","color":"cd7f32","default":false}],"state":"closed","locked":false,"assignee":{"login":"pongad","id":1617025,"avatar_url":"https://avatars1.githubusercontent.com/u/1617025?v=4","gravatar_id":"","url":"https://api.github.com/users/pongad","html_url":"https://github.com/pongad","followers_url":"https://api.github.com/users/pongad/followers","following_url":"https://api.github.com/users/pongad/following{/other_user}","gists_url":"https://api.github.com/users/pongad/gists{/gist_id}","starred_url":"https://api.github.com/users/pongad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pongad/subscriptions","organizations_url":"https://api.github.com/users/pongad/orgs","repos_url":"https://api.github.com/users/pongad/repos","events_url":"https://api.github.com/users/pongad/events{/privacy}","received_events_url":"https://api.github.com/users/pongad/received_events","type":"User","site_admin":false},"assignees":[{"login":"pongad","id":1617025,"avatar_url":"https://avatars1.githubusercontent.com/u/1617025?v=4","gravatar_id":"","url":"https://api.github.com/users/pongad","html_url":"https://github.com/pongad","followers_url":"https://api.github.com/users/pongad/followers","following_url":"https://api.github.com/users/pongad/following{/other_user}","gists_url":"https://api.github.com/users/pongad/gists{/gist_id}","starred_url":"https://api.github.com/users/pongad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pongad/subscriptions","organizations_url":"https://api.github.com/users/pongad/orgs","repos_url":"https://api.github.com/users/pongad/repos","events_url":"https://api.github.com/users/pongad/events{/privacy}","received_events_url":"https://api.github.com/users/pongad/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2017-10-04T03:05:39Z","updated_at":"2017-10-23T03:48:31Z","closed_at":"2017-10-23T03:48:31Z","author_association":"NONE","body":"To reproduce,\r\n1. Create an empty BigQuery table without any field on its schema. Let's say it's table \"tableA\" on dataset \"dataset1\".\r\n2. Running this code fails the assertion.\r\n```\r\n    BigQuery bigQuery = BigQueryOptions.getDefaultInstance().getService();\r\n    Table table = bigQuery.getTable(\"dataset1\", \"tableA\");\r\n    Assert.assertNotNull(table.getDefinition().getSchema());\r\n```\r\n\r\nIs 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`.\r\n```\r\n    /**\r\n     * Sets the table schema.\r\n     */\r\n    public B setSchema(Schema schema) {\r\n      this.schema = checkNotNull(schema);\r\n      return self();\r\n    }\r\n```\r\nI think `BigQuery.getTable` on a table with empty schema should return a Schema instance with no field within its TableDefinition."}}
{"actor":{"display_login":"pongad"}}