Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.

Commit 39cd054

Browse files
committed
refactor(bigquery): Clean up sample test resources, fix comments
1 parent bebf1c6 commit 39cd054

5 files changed

Lines changed: 8 additions & 12 deletions

File tree

google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryImpl.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,9 +441,6 @@ public com.google.api.services.bigquery.model.Job call() throws IOException {
441441
&& createException.getCause() != null
442442
&& createException.getCause().getMessage() != null) {
443443

444-
/*GoogleJsonResponseException createExceptionCause =
445-
(GoogleJsonResponseException) createException.getCause();*/
446-
447444
Pattern pattern = Pattern.compile(".*Already.*Exists:.*Job.*", Pattern.CASE_INSENSITIVE);
448445
Matcher matcher = pattern.matcher(createException.getCause().getMessage());
449446

google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/QueryJobConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ private Builder(com.google.api.services.bigquery.model.JobConfiguration configur
187187
this();
188188
JobConfigurationQuery queryConfigurationPb = configurationPb.getQuery();
189189
this.query = queryConfigurationPb.getQuery();
190-
// Allows to get undeclaredqueryparameters in jobstatistics2
190+
// Allows to get undeclared query parameters in jobstatistics
191191
if (queryConfigurationPb.getQueryParameters() == null
192192
&& queryConfigurationPb.getParameterMode() != null) {
193193
parameterMode = queryConfigurationPb.getParameterMode();

google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/spi/v2/HttpBigQueryRpc.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,8 @@ public Dataset createSkipExceptionTranslation(Dataset dataset, Map<Option, ?> op
208208
.insert(dataset.getDatasetReference().getProjectId(), dataset)
209209
.setPrettyPrint(false)
210210
.setFields(Option.FIELDS.getString(options));
211-
for (Map.Entry<Option, ?> entry : options.entrySet()) {
212-
if (entry.getKey() == Option.ACCESS_POLICY_VERSION && entry.getValue() != null) {
213-
bqCreateRequest.setAccessPolicyVersion((Integer) entry.getValue());
214-
}
211+
if (options.containsKey(Option.ACCESS_POLICY_VERSION)) {
212+
bqCreateRequest.setAccessPolicyVersion((Integer) options.get(Option.ACCESS_POLICY_VERSION));
215213
}
216214
return bqCreateRequest.execute();
217215
}

google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,7 @@ public void testUpdateDatasetWithSelectedFields() {
13341334
}
13351335

13361336
@Test
1337-
public void testUpdateDatabaseWithAccessPolicyVersion() throws IOException {
1337+
public void testUpdateDatasetWithAccessPolicyVersion() throws IOException {
13381338
String accessPolicyDataset = RemoteBigQueryHelper.generateDatasetName();
13391339
ServiceAccountCredentials credentials =
13401340
(ServiceAccountCredentials) GoogleCredentials.getApplicationDefault();
@@ -1827,7 +1827,7 @@ public void testCreateDatasetWithAccessPolicyVersion() throws IOException {
18271827
}
18281828

18291829
@Test(expected = BigQueryException.class)
1830-
public void testCreateDatabaseWithInvalidAccessPolicyVersion() throws IOException {
1830+
public void testCreateDatasetWithInvalidAccessPolicyVersion() throws IOException {
18311831
String accessPolicyDataset = RemoteBigQueryHelper.generateDatasetName();
18321832
ServiceAccountCredentials credentials =
18331833
(ServiceAccountCredentials) GoogleCredentials.getApplicationDefault();
@@ -4040,7 +4040,7 @@ public void testBQResultSetPagination() throws SQLException {
40404040
assertEquals(300000, cnt); // total 300000 rows should be read
40414041
}
40424042

4043-
// @Test - Temporarily disabling till https://github.com/googleapis/gax-java/issues/1712 or
4043+
@Test //- Temporarily disabling till https://github.com/googleapis/gax-java/issues/1712 or
40444044
// b/235591056 are resolved
40454045
public void testReadAPIIterationAndOrder()
40464046
throws SQLException { // use read API to read 300K records and check the order
@@ -4240,7 +4240,7 @@ public void testCreateDefaultConnection() throws BigQuerySQLException {
42404240
assertTrue(connection.close());
42414241
}
42424242

4243-
// @Test - Temporarily disabling till https://github.com/googleapis/gax-java/issues/1712 or
4243+
@Test //- Temporarily disabling till https://github.com/googleapis/gax-java/issues/1712 or
42444244
// b/235591056 are resolved
42454245
public void testReadAPIConnectionMultiClose()
42464246
throws

samples/snippets/src/test/java/com/example/bigquery/GrantViewAccessIT.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ public void tearDown() {
9494
DeleteTable.deleteTable(viewDatasetName, viewName);
9595
DeleteTable.deleteTable(viewDatasetName, tableName);
9696
DeleteDataset.deleteDataset(PROJECT_ID, datasetName);
97+
DeleteDataset.deleteDataset(PROJECT_ID, viewDatasetName);
9798
// restores print statements in the original method
9899
System.out.flush();
99100
System.setOut(originalPrintStream);

0 commit comments

Comments
 (0)