Skip to content

Commit d22b1b2

Browse files
committed
regenerates Table.java samples
1 parent 94b6fb8 commit d22b1b2

File tree

2 files changed

+26
-26
lines changed
  • google-cloud-bigquery/src/main/java/com/google/cloud/bigquery
  • google-cloud-examples/src/main/java/com/google/cloud/examples/bigquery/snippets

2 files changed

+26
-26
lines changed

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

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -301,11 +301,10 @@ public InsertAllResponse insert(Iterable<InsertAllRequest.RowToInsert> rows,
301301
* Returns the paginated list rows in this table.
302302
*
303303
* <p>Example of listing rows in the table.
304-
*
305-
* <pre>{@code
304+
* <pre> {@code
306305
* // This example reads the result 100 rows per RPC call. If there's no need to limit the number,
307306
* // simply omit the option.
308-
* TableResult page = table.list(TableDataListOption.pageSize(100));
307+
* Page<FieldValueList> page = table.list(TableDataListOption.pageSize(100));
309308
* for (FieldValueList row : page.iterateAll()) {
310309
* // do something with the row
311310
* }
@@ -321,12 +320,11 @@ public TableResult list(TableDataListOption... options) throws BigQueryException
321320
/**
322321
* Returns the paginated list rows in this table.
323322
*
324-
* <p>Example of listing rows in the table.
325-
*
326-
* <pre>{@code
323+
* <p>Example of listing rows in the table given a schema.
324+
* <pre> {@code
327325
* Schema schema = ...;
328326
* String field = "my_field";
329-
* TableResult page = table.list(schema);
327+
* Page<FieldValueList> page = table.list(schema);
330328
* for (FieldValueList row : page.iterateAll()) {
331329
* row.get(field);
332330
* }
@@ -351,14 +349,14 @@ public TableResult list(Schema schema, TableDataListOption... options)
351349
* Job job = table.copy(datasetName, tableName);
352350
* // Wait for the job to complete.
353351
* try {
354-
* Job completedJob = job.waitFor(RetryOption.checkEvery(1, TimeUnit.SECONDS),
355-
* RetryOption.timeout(3, TimeUnit.MINUTES));
352+
* Job completedJob = job.waitFor(RetryOption.initialRetryDelay(Duration.ofSeconds(1)),
353+
* RetryOption.totalTimeout(Duration.ofMinutes(3)));
356354
* if (completedJob != null && completedJob.getStatus().getError() == null) {
357355
* // Job completed successfully
358356
* } else {
359357
* // Handle error case
360358
* }
361-
* } catch (InterruptedException | TimeoutException e) {
359+
* } catch (InterruptedException e) {
362360
* // Handle interrupted wait
363361
* }
364362
* }</pre>
@@ -386,14 +384,14 @@ public Job copy(String destinationDataset, String destinationTable, JobOption...
386384
* Job job = table.copy(destinationId, options);
387385
* // Wait for the job to complete.
388386
* try {
389-
* Job completedJob = job.waitFor(RetryOption.checkEvery(1, TimeUnit.SECONDS),
390-
* RetryOption.timeout(3, TimeUnit.MINUTES));
387+
* Job completedJob = job.waitFor(RetryOption.initialRetryDelay(Duration.ofSeconds(1)),
388+
* RetryOption.totalTimeout(Duration.ofMinutes(3)));
391389
* if (completedJob != null && completedJob.getStatus().getError() == null) {
392390
* // Job completed successfully.
393391
* } else {
394392
* // Handle error case.
395393
* }
396-
* } catch (InterruptedException | TimeoutException e) {
394+
* } catch (InterruptedException e) {
397395
* // Handle interrupted wait
398396
* }
399397
* }</pre>
@@ -419,14 +417,14 @@ public Job copy(TableId destinationTable, JobOption... options)
419417
* Job job = table.extract(format, gcsUrl);
420418
* // Wait for the job to complete
421419
* try {
422-
* Job completedJob = job.waitFor(RetryOption.checkEvery(1, TimeUnit.SECONDS),
423-
* RetryOption.timeout(3, TimeUnit.MINUTES));
420+
* Job completedJob = job.waitFor(RetryOption.initialRetryDelay(Duration.ofSeconds(1)),
421+
* RetryOption.totalTimeout(Duration.ofMinutes(3)));
424422
* if (completedJob != null && completedJob.getStatus().getError() == null) {
425423
* // Job completed successfully
426424
* } else {
427425
* // Handle error case
428426
* }
429-
* } catch (InterruptedException | TimeoutException e) {
427+
* } catch (InterruptedException e) {
430428
* // Handle interrupted wait
431429
* }
432430
* }</pre>
@@ -457,14 +455,14 @@ public Job extract(String format, String destinationUri, JobOption... options)
457455
* Job job = table.extract(format, destinationUris);
458456
* // Wait for the job to complete
459457
* try {
460-
* Job completedJob = job.waitFor(RetryOption.checkEvery(1, TimeUnit.SECONDS),
461-
* RetryOption.timeout(3, TimeUnit.MINUTES));
458+
* Job completedJob = job.waitFor(RetryOption.initialRetryDelay(Duration.ofSeconds(1)),
459+
* RetryOption.totalTimeout(Duration.ofMinutes(3)));
462460
* if (completedJob != null && completedJob.getStatus().getError() == null) {
463461
* // Job completed successfully
464462
* } else {
465463
* // Handle error case
466464
* }
467-
* } catch (InterruptedException | TimeoutException e) {
465+
* } catch (InterruptedException e) {
468466
* // Handle interrupted wait
469467
* }
470468
* }</pre>
@@ -492,14 +490,14 @@ public Job extract(String format, List<String> destinationUris, JobOption... opt
492490
* Job job = table.load(FormatOptions.csv(), sourceUri);
493491
* // Wait for the job to complete
494492
* try {
495-
* Job completedJob = job.waitFor(RetryOption.checkEvery(1, TimeUnit.SECONDS),
496-
* RetryOption.timeout(3, TimeUnit.MINUTES));
493+
* Job completedJob = job.waitFor(RetryOption.initialRetryDelay(Duration.ofSeconds(1)),
494+
* RetryOption.totalTimeout(Duration.ofMinutes(3)));
497495
* if (completedJob != null && completedJob.getStatus().getError() == null) {
498496
* // Job completed successfully
499497
* } else {
500498
* // Handle error case
501499
* }
502-
* } catch (InterruptedException | TimeoutException e) {
500+
* } catch (InterruptedException e) {
503501
* // Handle interrupted wait
504502
* }
505503
* }</pre>
@@ -529,14 +527,14 @@ public Job load(FormatOptions format, String sourceUri, JobOption... options)
529527
* Job job = table.load(FormatOptions.csv(), sourceUris);
530528
* // Wait for the job to complete
531529
* try {
532-
* Job completedJob = job.waitFor(RetryOption.checkEvery(1, TimeUnit.SECONDS),
533-
* RetryOption.timeout(3, TimeUnit.MINUTES));
530+
* Job completedJob = job.waitFor(RetryOption.initialRetryDelay(Duration.ofSeconds(1)),
531+
* RetryOption.totalTimeout(Duration.ofMinutes(3)));
534532
* if (completedJob != null && completedJob.getStatus().getError() == null) {
535533
* // Job completed successfully
536534
* } else {
537535
* // Handle error case
538536
* }
539-
* } catch (InterruptedException | TimeoutException e) {
537+
* } catch (InterruptedException e) {
540538
* // Handle interrupted wait
541539
* }
542540
* }</pre>

google-cloud-examples/src/main/java/com/google/cloud/examples/bigquery/snippets/TableSnippets.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,9 @@ public Page<FieldValueList> list() {
177177
return page;
178178
}
179179

180-
/** Example of listing rows in the table. */
180+
/**
181+
* Example of listing rows in the table given a schema.
182+
*/
181183
// [TARGET list(Schema, TableDataListOption...)]
182184
// [VARIABLE ...]
183185
// [VARIABLE "my_field"]

0 commit comments

Comments
 (0)