Skip to content

Commit 7ee6c4a

Browse files
committed
---
yaml --- r: 1291 b: refs/heads/bigquery c: 120fe12 h: refs/heads/master i: 1289: 24f5cf6 1287: bc4d065 v: v3
1 parent f3a3a5e commit 7ee6c4a

3 files changed

Lines changed: 9 additions & 49 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
refs/heads/master: a25e50430b55b93816be392e363638e67f67a500
33
refs/heads/travis: e21ee7b88a5edc3f3d8c71f90c3fc32abf7e8dd6
44
refs/heads/gh-pages: d1b373c30c176edc08692348167bec3a244bb823
5-
refs/heads/bigquery: 12aa55591cde5f0f5b3bbf6e4d29c7d049925c5f
5+
refs/heads/bigquery: 120fe1228f8df9e770980be6c576cffab7e48f2f

branches/bigquery/gcloud-java-bigquery/src/main/java/com/google/gcloud/spi/BigQueryRpc.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ public interface BigQueryRpc {
3535

3636
// These options are part of the Google Cloud BigQuery query parameters
3737
enum Option {
38-
QUOTA_USER("quotaUser"),
39-
USER_IP("userIp"),
4038
FIELDS("fields"),
4139
DELETE_CONTENTS("deleteContents"),
4240
ALL_DATASETS("all"),

branches/bigquery/gcloud-java-bigquery/src/main/java/com/google/gcloud/spi/DefaultBigQueryRpc.java

Lines changed: 8 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@
1616

1717
import static com.google.gcloud.spi.BigQueryRpc.Option.DELETE_CONTENTS;
1818
import static com.google.gcloud.spi.BigQueryRpc.Option.FIELDS;
19-
import static com.google.gcloud.spi.BigQueryRpc.Option.QUOTA_USER;
2019
import static com.google.gcloud.spi.BigQueryRpc.Option.START_INDEX;
2120
import static com.google.gcloud.spi.BigQueryRpc.Option.TIMEOUT;
22-
import static com.google.gcloud.spi.BigQueryRpc.Option.USER_IP;
2321
import static java.net.HttpURLConnection.HTTP_NOT_FOUND;
2422

2523
import com.google.api.client.googleapis.json.GoogleJsonError;
@@ -104,8 +102,6 @@ public Dataset getDataset(String datasetId, Map<Option, ?> options) throws BigQu
104102
return bigquery.datasets()
105103
.get(this.options.projectId(), datasetId)
106104
.setFields(FIELDS.getString(options))
107-
.setQuotaUser(QUOTA_USER.getString(options))
108-
.setUserIp(USER_IP.getString(options))
109105
.execute();
110106
} catch(IOException ex) {
111107
BigQueryException serviceException = translate(ex);
@@ -122,8 +118,6 @@ public Tuple<String, Iterable<Dataset>> listDatasets(Map<Option, ?> options)
122118
try {
123119
DatasetList datasetsList = bigquery.datasets()
124120
.list(this.options.projectId())
125-
.setQuotaUser(QUOTA_USER.getString(options))
126-
.setUserIp(USER_IP.getString(options))
127121
.setAll(Option.ALL_DATASETS.getBoolean(options))
128122
.setMaxResults(MAX_RESULTS.getLong(options))
129123
.setPageToken(PAGE_TOKEN.getString(options))
@@ -151,8 +145,6 @@ public Dataset create(Dataset dataset, Map<Option, ?> options) throws BigQueryEx
151145
try {
152146
return bigquery.datasets().insert(this.options.projectId(), dataset)
153147
.setFields(FIELDS.getString(options))
154-
.setQuotaUser(QUOTA_USER.getString(options))
155-
.setUserIp(USER_IP.getString(options))
156148
.execute();
157149
} catch (IOException ex) {
158150
throw translate(ex);
@@ -163,8 +155,6 @@ public Dataset create(Dataset dataset, Map<Option, ?> options) throws BigQueryEx
163155
public boolean deleteDataset(String datasetId, Map<Option, ?> options) throws BigQueryException {
164156
try {
165157
bigquery.datasets().delete(this.options.projectId(), datasetId)
166-
.setQuotaUser(QUOTA_USER.getString(options))
167-
.setUserIp(USER_IP.getString(options))
168158
.setDeleteContents(DELETE_CONTENTS.getBoolean(options))
169159
.execute();
170160
return true;
@@ -181,10 +171,9 @@ public boolean deleteDataset(String datasetId, Map<Option, ?> options) throws Bi
181171
public Dataset patch(Dataset dataset, Map<Option, ?> options) throws BigQueryException {
182172
try {
183173
DatasetReference reference = dataset.getDatasetReference();
184-
return bigquery.datasets().patch(reference.getProjectId(), reference.getDatasetId(), dataset)
174+
return bigquery.datasets()
175+
.patch(this.options.projectId(), reference.getDatasetId(), dataset)
185176
.setFields(FIELDS.getString(options))
186-
.setQuotaUser(QUOTA_USER.getString(options))
187-
.setUserIp(USER_IP.getString(options))
188177
.execute();
189178
} catch (IOException ex) {
190179
throw translate(ex);
@@ -198,8 +187,6 @@ public Table getTable(String datasetId, String tableId, Map<Option, ?> options)
198187
return bigquery.tables()
199188
.get(this.options.projectId(), datasetId, tableId)
200189
.setFields(FIELDS.getString(options))
201-
.setQuotaUser(QUOTA_USER.getString(options))
202-
.setUserIp(USER_IP.getString(options))
203190
.execute();
204191
} catch(IOException ex) {
205192
BigQueryException serviceException = translate(ex);
@@ -216,8 +203,6 @@ public Tuple<String, Iterable<Table>> listTables(String datasetId, Map<Option, ?
216203
try {
217204
TableList tableList = bigquery.tables()
218205
.list(this.options.projectId(), datasetId)
219-
.setQuotaUser(QUOTA_USER.getString(options))
220-
.setUserIp(USER_IP.getString(options))
221206
.setMaxResults(MAX_RESULTS.getLong(options))
222207
.setPageToken(PAGE_TOKEN.getString(options))
223208
.execute();
@@ -247,8 +232,6 @@ public Table create(Table table, Map<Option, ?> options)
247232
return bigquery.tables()
248233
.insert(this.options.projectId(), table.getTableReference().getDatasetId(), table)
249234
.setFields(FIELDS.getString(options))
250-
.setQuotaUser(QUOTA_USER.getString(options))
251-
.setUserIp(USER_IP.getString(options))
252235
.execute();
253236
} catch (IOException ex) {
254237
throw translate(ex);
@@ -259,14 +242,11 @@ public Table create(Table table, Map<Option, ?> options)
259242
public boolean deleteTable(String datasetId, String tableId, Map<Option, ?> options)
260243
throws BigQueryException {
261244
try {
262-
bigquery.tables().delete(this.options.projectId(), datasetId, tableId)
263-
.setQuotaUser(QUOTA_USER.getString(options))
264-
.setUserIp(USER_IP.getString(options))
265-
.execute();
245+
bigquery.tables().delete(this.options.projectId(), datasetId, tableId).execute();
266246
return true;
267247
} catch (IOException ex) {
268248
BigQueryException serviceException = translate(ex);
269-
if (serviceException.code() == 404) {
249+
if (serviceException.code() == HTTP_NOT_FOUND) {
270250
return false;
271251
}
272252
throw serviceException;
@@ -278,10 +258,8 @@ public Table patch(Table table, Map<Option, ?> options) throws BigQueryException
278258
try {
279259
TableReference reference = table.getTableReference();
280260
return bigquery.tables()
281-
.patch(reference.getProjectId(), reference.getDatasetId(), reference.getTableId(), table)
261+
.patch(this.options.projectId(), reference.getDatasetId(), reference.getTableId(), table)
282262
.setFields(FIELDS.getString(options))
283-
.setQuotaUser(QUOTA_USER.getString(options))
284-
.setUserIp(USER_IP.getString(options))
285263
.execute();
286264
} catch (IOException ex) {
287265
throw translate(ex);
@@ -294,8 +272,6 @@ public TableDataInsertAllResponse insertAll(TableReference table,
294272
try {
295273
return bigquery.tabledata()
296274
.insertAll(this.options.projectId(), table.getDatasetId(), table.getTableId(), request)
297-
.setQuotaUser(QUOTA_USER.getString(options))
298-
.setUserIp(USER_IP.getString(options))
299275
.execute();
300276
} catch (IOException ex) {
301277
throw translate(ex);
@@ -308,8 +284,6 @@ public Tuple<String, Iterable<TableRow>> listTableData(String datasetId, String
308284
try {
309285
TableDataList tableDataList = bigquery.tabledata()
310286
.list(this.options.projectId(), datasetId, tableId)
311-
.setQuotaUser(QUOTA_USER.getString(options))
312-
.setUserIp(USER_IP.getString(options))
313287
.setMaxResults(MAX_RESULTS.getLong(options))
314288
.setPageToken(PAGE_TOKEN.getString(options))
315289
.setStartIndex(START_INDEX.getLong(options) != null ?
@@ -328,8 +302,6 @@ public Job getJob(String jobId, Map<Option, ?> options) throws BigQueryException
328302
return bigquery.jobs()
329303
.get(this.options.projectId(), jobId)
330304
.setFields(FIELDS.getString(options))
331-
.setQuotaUser(QUOTA_USER.getString(options))
332-
.setUserIp(USER_IP.getString(options))
333305
.execute();
334306
} catch(IOException ex) {
335307
BigQueryException serviceException = translate(ex);
@@ -386,8 +358,6 @@ public Job create(Job job, Map<Option, ?> options) throws BigQueryException {
386358
return bigquery.jobs()
387359
.insert(this.options.projectId(), job)
388360
.setFields(FIELDS.getString(options))
389-
.setQuotaUser(QUOTA_USER.getString(options))
390-
.setUserIp(USER_IP.getString(options))
391361
.execute();
392362
} catch (IOException ex) {
393363
throw translate(ex);
@@ -397,10 +367,7 @@ public Job create(Job job, Map<Option, ?> options) throws BigQueryException {
397367
@Override
398368
public boolean cancel(String jobId, Map<Option, ?> options) throws BigQueryException {
399369
try {
400-
bigquery.jobs().cancel(this.options.projectId(), jobId)
401-
.setQuotaUser(QUOTA_USER.getString(options))
402-
.setUserIp(USER_IP.getString(options))
403-
.execute();
370+
bigquery.jobs().cancel(this.options.projectId(), jobId).execute();
404371
return true;
405372
} catch (IOException ex) {
406373
BigQueryException serviceException = translate(ex);
@@ -415,9 +382,7 @@ public boolean cancel(String jobId, Map<Option, ?> options) throws BigQueryExcep
415382
public GetQueryResultsResponse getQueryResults(JobReference job, Map<Option, ?> options)
416383
throws BigQueryException {
417384
try {
418-
return bigquery.jobs().getQueryResults(this.options.projectId(), job.getProjectId())
419-
.setQuotaUser(QUOTA_USER.getString(options))
420-
.setUserIp(USER_IP.getString(options))
385+
return bigquery.jobs().getQueryResults(this.options.projectId(), job.getJobId())
421386
.setMaxResults(MAX_RESULTS.getLong(options))
422387
.setPageToken(PAGE_TOKEN.getString(options))
423388
.setStartIndex(START_INDEX.getLong(options) != null ?
@@ -437,10 +402,7 @@ public GetQueryResultsResponse getQueryResults(JobReference job, Map<Option, ?>
437402
public QueryResponse query(QueryRequest request, Map<Option, ?> options)
438403
throws BigQueryException {
439404
try {
440-
return bigquery.jobs().query(this.options.projectId(), request)
441-
.setQuotaUser(QUOTA_USER.getString(options))
442-
.setUserIp(USER_IP.getString(options))
443-
.execute();
405+
return bigquery.jobs().query(this.options.projectId(), request).execute();
444406
} catch (IOException ex) {
445407
throw translate(ex);
446408
}

0 commit comments

Comments
 (0)