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

Commit bdf35e0

Browse files
feat: re-generated to pick up changes from googleapis. (#435)
* changes without context autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. * feat: migrate bq/storage/v1beta1 to gapic v2 - adds new resource name classes PiperOrigin-RevId: 322235422 Source-Author: Google APIs <noreply@google.com> Source-Date: Mon Jul 20 15:14:29 2020 -0700 Source-Repo: googleapis/googleapis Source-Sha: d7a347b819096886f4644b0ed5a978a777f4bbb4 Source-Link: googleapis/googleapis@d7a347b * fix: add missing resource name deps to v1beta1 (#436) Co-authored-by: Noah Dietz <noahdietz@users.noreply.github.com>
1 parent e83b6b3 commit bdf35e0

File tree

10 files changed

+689
-47
lines changed

10 files changed

+689
-47
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ If you are using Maven without BOM, add this to your dependencies:
3838
<dependency>
3939
<groupId>com.google.cloud</groupId>
4040
<artifactId>google-cloud-bigquerystorage</artifactId>
41-
<version>1.1.1</version>
41+
<version>1.2.0</version>
4242
</dependency>
4343

4444
```

google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta1/BaseBigQueryStorageClient.java

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
* <code>
5151
* try (BaseBigQueryStorageClient baseBigQueryStorageClient = BaseBigQueryStorageClient.create()) {
5252
* TableReference tableReference = TableReference.newBuilder().build();
53-
* String parent = "";
53+
* ProjectName parent = ProjectName.of("[PROJECT]");
5454
* int requestedStreams = 0;
5555
* ReadSession response = baseBigQueryStorageClient.createReadSession(tableReference, parent, requestedStreams);
5656
* }
@@ -180,7 +180,7 @@ public BigQueryStorageStub getStub() {
180180
* <pre><code>
181181
* try (BaseBigQueryStorageClient baseBigQueryStorageClient = BaseBigQueryStorageClient.create()) {
182182
* TableReference tableReference = TableReference.newBuilder().build();
183-
* String parent = "";
183+
* ProjectName parent = ProjectName.of("[PROJECT]");
184184
* int requestedStreams = 0;
185185
* ReadSession response = baseBigQueryStorageClient.createReadSession(tableReference, parent, requestedStreams);
186186
* }
@@ -196,6 +196,51 @@ public BigQueryStorageStub getStub() {
196196
* <p>Streams must be read starting from offset 0.
197197
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
198198
*/
199+
public final ReadSession createReadSession(
200+
TableReference tableReference, ProjectName parent, int requestedStreams) {
201+
CreateReadSessionRequest request =
202+
CreateReadSessionRequest.newBuilder()
203+
.setTableReference(tableReference)
204+
.setParent(parent == null ? null : parent.toString())
205+
.setRequestedStreams(requestedStreams)
206+
.build();
207+
return createReadSession(request);
208+
}
209+
210+
// AUTO-GENERATED DOCUMENTATION AND METHOD
211+
/**
212+
* Creates a new read session. A read session divides the contents of a BigQuery table into one or
213+
* more streams, which can then be used to read data from the table. The read session also
214+
* specifies properties of the data to be read, such as a list of columns or a push-down filter
215+
* describing the rows to be returned.
216+
*
217+
* <p>A particular row can be read by at most one stream. When the caller has reached the end of
218+
* each stream in the session, then all the data in the table has been read.
219+
*
220+
* <p>Read sessions automatically expire 24 hours after they are created and do not require manual
221+
* clean-up by the caller.
222+
*
223+
* <p>Sample code:
224+
*
225+
* <pre><code>
226+
* try (BaseBigQueryStorageClient baseBigQueryStorageClient = BaseBigQueryStorageClient.create()) {
227+
* TableReference tableReference = TableReference.newBuilder().build();
228+
* ProjectName parent = ProjectName.of("[PROJECT]");
229+
* int requestedStreams = 0;
230+
* ReadSession response = baseBigQueryStorageClient.createReadSession(tableReference, parent.toString(), requestedStreams);
231+
* }
232+
* </code></pre>
233+
*
234+
* @param tableReference Required. Reference to the table to read.
235+
* @param parent Required. String of the form `projects/{project_id}` indicating the project this
236+
* ReadSession is associated with. This is the project that will be billed for usage.
237+
* @param requestedStreams Initial number of streams. If unset or 0, we will provide a value of
238+
* streams so as to produce reasonable throughput. Must be non-negative. The number of streams
239+
* may be lower than the requested number, depending on the amount parallelism that is
240+
* reasonable for the table and the maximum amount of parallelism allowed by the system.
241+
* <p>Streams must be read starting from offset 0.
242+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
243+
*/
199244
public final ReadSession createReadSession(
200245
TableReference tableReference, String parent, int requestedStreams) {
201246
CreateReadSessionRequest request =
@@ -225,10 +270,10 @@ public final ReadSession createReadSession(
225270
* <pre><code>
226271
* try (BaseBigQueryStorageClient baseBigQueryStorageClient = BaseBigQueryStorageClient.create()) {
227272
* TableReference tableReference = TableReference.newBuilder().build();
228-
* String parent = "";
273+
* ProjectName parent = ProjectName.of("[PROJECT]");
229274
* CreateReadSessionRequest request = CreateReadSessionRequest.newBuilder()
230275
* .setTableReference(tableReference)
231-
* .setParent(parent)
276+
* .setParent(parent.toString())
232277
* .build();
233278
* ReadSession response = baseBigQueryStorageClient.createReadSession(request);
234279
* }
@@ -259,10 +304,10 @@ public final ReadSession createReadSession(CreateReadSessionRequest request) {
259304
* <pre><code>
260305
* try (BaseBigQueryStorageClient baseBigQueryStorageClient = BaseBigQueryStorageClient.create()) {
261306
* TableReference tableReference = TableReference.newBuilder().build();
262-
* String parent = "";
307+
* ProjectName parent = ProjectName.of("[PROJECT]");
263308
* CreateReadSessionRequest request = CreateReadSessionRequest.newBuilder()
264309
* .setTableReference(tableReference)
265-
* .setParent(parent)
310+
* .setParent(parent.toString())
266311
* .build();
267312
* ApiFuture&lt;ReadSession&gt; future = baseBigQueryStorageClient.createReadSessionCallable().futureCall(request);
268313
* // Do something

google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta1/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* <code>
3232
* try (BaseBigQueryStorageClient baseBigQueryStorageClient = BaseBigQueryStorageClient.create()) {
3333
* TableReference tableReference = TableReference.newBuilder().build();
34-
* String parent = "";
34+
* ProjectName parent = ProjectName.of("[PROJECT]");
3535
* int requestedStreams = 0;
3636
* ReadSession response = baseBigQueryStorageClient.createReadSession(tableReference, parent, requestedStreams);
3737
* }

google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta1/stub/BigQueryStorageStubSettings.java

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -229,13 +229,18 @@ public static class Builder extends StubSettings.Builder<BigQueryStorageStubSett
229229
ImmutableMap.Builder<String, ImmutableSet<StatusCode.Code>> definitions =
230230
ImmutableMap.builder();
231231
definitions.put(
232-
"idempotent",
232+
"retry_policy_1_codes",
233233
ImmutableSet.copyOf(
234234
Lists.<StatusCode.Code>newArrayList(
235235
StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
236-
definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
236+
definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
237237
definitions.put(
238-
"unary_streaming",
238+
"retry_policy_3_codes",
239+
ImmutableSet.copyOf(
240+
Lists.<StatusCode.Code>newArrayList(
241+
StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
242+
definitions.put(
243+
"retry_policy_2_codes",
239244
ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList(StatusCode.Code.UNAVAILABLE)));
240245
RETRYABLE_CODE_DEFINITIONS = definitions.build();
241246
}
@@ -250,34 +255,36 @@ public static class Builder extends StubSettings.Builder<BigQueryStorageStubSett
250255
.setInitialRetryDelay(Duration.ofMillis(100L))
251256
.setRetryDelayMultiplier(1.3)
252257
.setMaxRetryDelay(Duration.ofMillis(60000L))
253-
.setInitialRpcTimeout(Duration.ofMillis(20000L))
258+
.setInitialRpcTimeout(Duration.ofMillis(600000L))
254259
.setRpcTimeoutMultiplier(1.0)
255-
.setMaxRpcTimeout(Duration.ofMillis(20000L))
260+
.setMaxRpcTimeout(Duration.ofMillis(600000L))
256261
.setTotalTimeout(Duration.ofMillis(600000L))
257262
.build();
258-
definitions.put("default", settings);
263+
definitions.put("retry_policy_1_params", settings);
259264
settings =
260265
RetrySettings.newBuilder()
261266
.setInitialRetryDelay(Duration.ofMillis(100L))
262267
.setRetryDelayMultiplier(1.3)
263268
.setMaxRetryDelay(Duration.ofMillis(60000L))
264-
.setInitialRpcTimeout(Duration.ofMillis(120000L))
269+
.setInitialRpcTimeout(Duration.ofMillis(86400000L))
265270
.setRpcTimeoutMultiplier(1.0)
266-
.setMaxRpcTimeout(Duration.ofMillis(120000L))
267-
.setTotalTimeout(Duration.ofMillis(600000L))
271+
.setMaxRpcTimeout(Duration.ofMillis(86400000L))
272+
.setTotalTimeout(Duration.ofMillis(86400000L))
268273
.build();
269-
definitions.put("create_read_session", settings);
274+
definitions.put("retry_policy_2_params", settings);
270275
settings =
271276
RetrySettings.newBuilder()
272277
.setInitialRetryDelay(Duration.ofMillis(100L))
273278
.setRetryDelayMultiplier(1.3)
274279
.setMaxRetryDelay(Duration.ofMillis(60000L))
275-
.setInitialRpcTimeout(Duration.ofMillis(86400000L))
280+
.setInitialRpcTimeout(Duration.ofMillis(600000L))
276281
.setRpcTimeoutMultiplier(1.0)
277-
.setMaxRpcTimeout(Duration.ofMillis(86400000L))
278-
.setTotalTimeout(Duration.ofMillis(86400000L))
282+
.setMaxRpcTimeout(Duration.ofMillis(600000L))
283+
.setTotalTimeout(Duration.ofMillis(600000L))
279284
.build();
280-
definitions.put("read_rows", settings);
285+
definitions.put("retry_policy_3_params", settings);
286+
settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build();
287+
definitions.put("no_retry_params", settings);
281288
RETRY_PARAM_DEFINITIONS = definitions.build();
282289
}
283290

@@ -321,28 +328,28 @@ private static Builder initDefaults(Builder builder) {
321328

322329
builder
323330
.createReadSessionSettings()
324-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
325-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("create_read_session"));
331+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
332+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
326333

327334
builder
328335
.readRowsSettings()
329-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("unary_streaming"))
330-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("read_rows"));
336+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes"))
337+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params"));
331338

332339
builder
333340
.batchCreateReadSessionStreamsSettings()
334-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
335-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
341+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_3_codes"))
342+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_3_params"));
336343

337344
builder
338345
.finalizeStreamSettings()
339-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
340-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
346+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_3_codes"))
347+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_3_params"));
341348

342349
builder
343350
.splitReadStreamSettings()
344-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
345-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
351+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_3_codes"))
352+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_3_params"));
346353

347354
return builder;
348355
}

google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta1/BaseBigQueryStorageClientTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ public void tearDown() throws Exception {
9494
@Test
9595
@SuppressWarnings("all")
9696
public void createReadSessionTest() {
97-
String name = "name3373707";
98-
ReadSession expectedResponse = ReadSession.newBuilder().setName(name).build();
97+
ReadSessionName name = ReadSessionName.of("[PROJECT]", "[LOCATION]", "[SESSION]");
98+
ReadSession expectedResponse = ReadSession.newBuilder().setName(name.toString()).build();
9999
mockBigQueryStorage.addResponse(expectedResponse);
100100

101101
TableReference tableReference = TableReference.newBuilder().build();
102-
String parent = "parent-995424086";
102+
ProjectName parent = ProjectName.of("[PROJECT]");
103103
int requestedStreams = 1017221410;
104104

105105
ReadSession actualResponse = client.createReadSession(tableReference, parent, requestedStreams);
@@ -110,7 +110,7 @@ public void createReadSessionTest() {
110110
CreateReadSessionRequest actualRequest = (CreateReadSessionRequest) actualRequests.get(0);
111111

112112
Assert.assertEquals(tableReference, actualRequest.getTableReference());
113-
Assert.assertEquals(parent, actualRequest.getParent());
113+
Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent()));
114114
Assert.assertEquals(requestedStreams, actualRequest.getRequestedStreams());
115115
Assert.assertTrue(
116116
channelProvider.isHeaderSent(
@@ -126,7 +126,7 @@ public void createReadSessionExceptionTest() throws Exception {
126126

127127
try {
128128
TableReference tableReference = TableReference.newBuilder().build();
129-
String parent = "parent-995424086";
129+
ProjectName parent = ProjectName.of("[PROJECT]");
130130
int requestedStreams = 1017221410;
131131

132132
client.createReadSession(tableReference, parent, requestedStreams);

proto-google-cloud-bigquerystorage-v1beta1/pom.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@
2121
<groupId>com.google.api.grpc</groupId>
2222
<artifactId>proto-google-common-protos</artifactId>
2323
</dependency>
24+
<dependency>
25+
<groupId>com.google.api</groupId>
26+
<artifactId>api-common</artifactId>
27+
</dependency>
28+
<dependency>
29+
<groupId>com.google.guava</groupId>
30+
<artifactId>guava</artifactId>
31+
</dependency>
2432
</dependencies>
2533

2634
<build>
@@ -31,4 +39,4 @@
3139
</plugin>
3240
</plugins>
3341
</build>
34-
</project>
42+
</project>

0 commit comments

Comments
 (0)