{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/comments/45290510","id":45290510,"diff_hunk":"@@ -0,0 +1,421 @@\n+/*\n+ * Copyright 2015 Google Inc. All Rights Reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except\n+ * in compliance with the License. You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software distributed under the License\n+ * is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\n+ * or implied. See the License for the specific language governing permissions and limitations under\n+ * the License.\n+ */\n+\n+package com.google.gcloud.spi;\n+\n+import static com.google.gcloud.spi.BigQueryRpc.Option.DELETE_CONTENTS;\n+import static com.google.gcloud.spi.BigQueryRpc.Option.FIELDS;\n+import static com.google.gcloud.spi.BigQueryRpc.Option.QUOTA_USER;\n+import static com.google.gcloud.spi.BigQueryRpc.Option.START_INDEX;\n+import static com.google.gcloud.spi.BigQueryRpc.Option.TIMEOUT;\n+import static com.google.gcloud.spi.BigQueryRpc.Option.USER_IP;\n+\n+import com.google.api.client.googleapis.json.GoogleJsonError;\n+import com.google.api.client.googleapis.json.GoogleJsonResponseException;\n+import com.google.api.client.http.HttpRequestInitializer;\n+import com.google.api.client.http.HttpTransport;\n+import com.google.api.client.json.jackson.JacksonFactory;\n+import com.google.api.services.bigquery.Bigquery;\n+import com.google.api.services.bigquery.model.Dataset;\n+import com.google.api.services.bigquery.model.DatasetList;\n+import com.google.api.services.bigquery.model.DatasetReference;\n+import com.google.api.services.bigquery.model.GetQueryResultsResponse;\n+import com.google.api.services.bigquery.model.Job;\n+import com.google.api.services.bigquery.model.JobList;\n+import com.google.api.services.bigquery.model.JobReference;\n+import com.google.api.services.bigquery.model.QueryRequest;\n+import com.google.api.services.bigquery.model.QueryResponse;\n+import com.google.api.services.bigquery.model.Table;\n+import com.google.api.services.bigquery.model.TableDataInsertAllRequest;\n+import com.google.api.services.bigquery.model.TableDataInsertAllResponse;\n+import com.google.api.services.bigquery.model.TableDataList;\n+import com.google.api.services.bigquery.model.TableList;\n+import com.google.api.services.bigquery.model.TableReference;\n+import com.google.api.services.bigquery.model.TableRow;\n+import com.google.common.base.Function;\n+import com.google.common.collect.ImmutableList;\n+import com.google.common.collect.ImmutableSet;\n+import com.google.common.collect.Iterables;\n+\n+import static com.google.gcloud.spi.BigQueryRpc.Option.MAX_RESULTS;\n+import static com.google.gcloud.spi.BigQueryRpc.Option.PAGE_TOKEN;\n+\n+import com.google.gcloud.bigquery.BigQueryException;\n+import com.google.gcloud.bigquery.BigQueryOptions;\n+\n+import java.io.IOException;\n+import java.math.BigInteger;\n+import java.util.List;\n+import java.util.Map;\n+import java.util.Set;\n+\n+public class DefaultBigQueryRpc implements BigQueryRpc {\n+\n+  public static final String DEFAULT_PROJECTION = \"full\";\n+  // see: https://cloud.google.com/bigquery/troubleshooting-errors\n+  private static final Set<Integer> RETRYABLE_CODES = ImmutableSet.of(503);","path":"gcloud-java-bigquery/src/main/java/com/google/gcloud/spi/DefaultBigQueryRpc.java","position":67,"original_position":67,"commit_id":"381d0563f1035395a4dbad759bef3c8bfc9166a6","original_commit_id":"381d0563f1035395a4dbad759bef3c8bfc9166a6","user":{"login":"ajkannan","id":5316886,"avatar_url":"https://avatars.githubusercontent.com/u/5316886?v=3","gravatar_id":"","url":"https://api.github.com/users/ajkannan","html_url":"https://github.com/ajkannan","followers_url":"https://api.github.com/users/ajkannan/followers","following_url":"https://api.github.com/users/ajkannan/following{/other_user}","gists_url":"https://api.github.com/users/ajkannan/gists{/gist_id}","starred_url":"https://api.github.com/users/ajkannan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajkannan/subscriptions","organizations_url":"https://api.github.com/users/ajkannan/orgs","repos_url":"https://api.github.com/users/ajkannan/repos","events_url":"https://api.github.com/users/ajkannan/events{/privacy}","received_events_url":"https://api.github.com/users/ajkannan/received_events","type":"User","site_admin":false},"body":"Should we add [these](https://cloud.google.com/bigquery/loading-data-post-request#best-practices) other 500-level error codes? ","created_at":"2015-11-19T01:52:48Z","updated_at":"2015-11-19T01:52:48Z","html_url":"https://github.com/GoogleCloudPlatform/gcloud-java/pull/367#discussion_r45290510","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/367","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/comments/45290510"},"html":{"href":"https://github.com/GoogleCloudPlatform/gcloud-java/pull/367#discussion_r45290510"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/367"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/367","id":50559509,"html_url":"https://github.com/GoogleCloudPlatform/gcloud-java/pull/367","diff_url":"https://github.com/GoogleCloudPlatform/gcloud-java/pull/367.diff","patch_url":"https://github.com/GoogleCloudPlatform/gcloud-java/pull/367.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/367","number":367,"state":"open","locked":false,"title":"Add BigQueryRpc default implementation","user":{"login":"mziccard","id":450933,"avatar_url":"https://avatars.githubusercontent.com/u/450933?v=3","gravatar_id":"","url":"https://api.github.com/users/mziccard","html_url":"https://github.com/mziccard","followers_url":"https://api.github.com/users/mziccard/followers","following_url":"https://api.github.com/users/mziccard/following{/other_user}","gists_url":"https://api.github.com/users/mziccard/gists{/gist_id}","starred_url":"https://api.github.com/users/mziccard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mziccard/subscriptions","organizations_url":"https://api.github.com/users/mziccard/orgs","repos_url":"https://api.github.com/users/mziccard/repos","events_url":"https://api.github.com/users/mziccard/events{/privacy}","received_events_url":"https://api.github.com/users/mziccard/received_events","type":"User","site_admin":false},"body":"This PR adds the `DefaultBigQueryRpc` class to the BigQuery module.\r\nBase functionalities are implemented. Possibly more will come later.","created_at":"2015-11-12T19:57:53Z","updated_at":"2015-11-19T01:52:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"844a4014bd9492e4545204a89f6eb46bca23b2fd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/367/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/367/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/367/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/statuses/381d0563f1035395a4dbad759bef3c8bfc9166a6","head":{"label":"mziccard:bigquery","ref":"bigquery","sha":"381d0563f1035395a4dbad759bef3c8bfc9166a6","user":{"login":"mziccard","id":450933,"avatar_url":"https://avatars.githubusercontent.com/u/450933?v=3","gravatar_id":"","url":"https://api.github.com/users/mziccard","html_url":"https://github.com/mziccard","followers_url":"https://api.github.com/users/mziccard/followers","following_url":"https://api.github.com/users/mziccard/following{/other_user}","gists_url":"https://api.github.com/users/mziccard/gists{/gist_id}","starred_url":"https://api.github.com/users/mziccard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mziccard/subscriptions","organizations_url":"https://api.github.com/users/mziccard/orgs","repos_url":"https://api.github.com/users/mziccard/repos","events_url":"https://api.github.com/users/mziccard/events{/privacy}","received_events_url":"https://api.github.com/users/mziccard/received_events","type":"User","site_admin":false},"repo":{"id":40965279,"name":"gcloud-java","full_name":"mziccard/gcloud-java","owner":{"login":"mziccard","id":450933,"avatar_url":"https://avatars.githubusercontent.com/u/450933?v=3","gravatar_id":"","url":"https://api.github.com/users/mziccard","html_url":"https://github.com/mziccard","followers_url":"https://api.github.com/users/mziccard/followers","following_url":"https://api.github.com/users/mziccard/following{/other_user}","gists_url":"https://api.github.com/users/mziccard/gists{/gist_id}","starred_url":"https://api.github.com/users/mziccard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mziccard/subscriptions","organizations_url":"https://api.github.com/users/mziccard/orgs","repos_url":"https://api.github.com/users/mziccard/repos","events_url":"https://api.github.com/users/mziccard/events{/privacy}","received_events_url":"https://api.github.com/users/mziccard/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mziccard/gcloud-java","description":"Google Cloud Client Library for Java","fork":true,"url":"https://api.github.com/repos/mziccard/gcloud-java","forks_url":"https://api.github.com/repos/mziccard/gcloud-java/forks","keys_url":"https://api.github.com/repos/mziccard/gcloud-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mziccard/gcloud-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mziccard/gcloud-java/teams","hooks_url":"https://api.github.com/repos/mziccard/gcloud-java/hooks","issue_events_url":"https://api.github.com/repos/mziccard/gcloud-java/issues/events{/number}","events_url":"https://api.github.com/repos/mziccard/gcloud-java/events","assignees_url":"https://api.github.com/repos/mziccard/gcloud-java/assignees{/user}","branches_url":"https://api.github.com/repos/mziccard/gcloud-java/branches{/branch}","tags_url":"https://api.github.com/repos/mziccard/gcloud-java/tags","blobs_url":"https://api.github.com/repos/mziccard/gcloud-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mziccard/gcloud-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mziccard/gcloud-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/mziccard/gcloud-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mziccard/gcloud-java/statuses/{sha}","languages_url":"https://api.github.com/repos/mziccard/gcloud-java/languages","stargazers_url":"https://api.github.com/repos/mziccard/gcloud-java/stargazers","contributors_url":"https://api.github.com/repos/mziccard/gcloud-java/contributors","subscribers_url":"https://api.github.com/repos/mziccard/gcloud-java/subscribers","subscription_url":"https://api.github.com/repos/mziccard/gcloud-java/subscription","commits_url":"https://api.github.com/repos/mziccard/gcloud-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/mziccard/gcloud-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/mziccard/gcloud-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/mziccard/gcloud-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/mziccard/gcloud-java/contents/{+path}","compare_url":"https://api.github.com/repos/mziccard/gcloud-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mziccard/gcloud-java/merges","archive_url":"https://api.github.com/repos/mziccard/gcloud-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mziccard/gcloud-java/downloads","issues_url":"https://api.github.com/repos/mziccard/gcloud-java/issues{/number}","pulls_url":"https://api.github.com/repos/mziccard/gcloud-java/pulls{/number}","milestones_url":"https://api.github.com/repos/mziccard/gcloud-java/milestones{/number}","notifications_url":"https://api.github.com/repos/mziccard/gcloud-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mziccard/gcloud-java/labels{/name}","releases_url":"https://api.github.com/repos/mziccard/gcloud-java/releases{/id}","created_at":"2015-08-18T10:16:17Z","updated_at":"2015-08-18T10:16:18Z","pushed_at":"2015-11-18T19:10:34Z","git_url":"git://github.com/mziccard/gcloud-java.git","ssh_url":"git@github.com:mziccard/gcloud-java.git","clone_url":"https://github.com/mziccard/gcloud-java.git","svn_url":"https://github.com/mziccard/gcloud-java","homepage":"http://googlecloudplatform.github.io/gcloud-java/site/0.0.6/","size":16093,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"GoogleCloudPlatform:bigquery","ref":"bigquery","sha":"13e976ad07c03301247e9a7bb52f41d4b6bc07ba","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":26181278,"name":"gcloud-java","full_name":"GoogleCloudPlatform/gcloud-java","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/gcloud-java","description":"Google Cloud Client Library for Java","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/releases{/id}","created_at":"2014-11-04T17:57:16Z","updated_at":"2015-11-17T01:15:32Z","pushed_at":"2015-11-18T23:37:17Z","git_url":"git://github.com/GoogleCloudPlatform/gcloud-java.git","ssh_url":"git@github.com:GoogleCloudPlatform/gcloud-java.git","clone_url":"https://github.com/GoogleCloudPlatform/gcloud-java.git","svn_url":"https://github.com/GoogleCloudPlatform/gcloud-java","homepage":"http://googlecloudplatform.github.io/gcloud-java/","size":206718,"stargazers_count":44,"watchers_count":44,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":24,"mirror_url":null,"open_issues_count":85,"forks":24,"open_issues":85,"watchers":44,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/367"},"html":{"href":"https://github.com/GoogleCloudPlatform/gcloud-java/pull/367"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/367"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/367/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/367/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/367/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/statuses/381d0563f1035395a4dbad759bef3c8bfc9166a6"}}}}