steveniemitz commented on a change in pull request #16561:
URL: https://github.com/apache/beam/pull/16561#discussion_r788032113



##########
File path: 
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/WriteResult.java
##########
@@ -77,13 +96,41 @@ private WriteResult(
       PCollection<TableRow> failedInserts,
       TupleTag<BigQueryInsertError> failedInsertsWithErrTag,
       PCollection<BigQueryInsertError> failedInsertsWithErr,
-      PCollection<TableRow> successfulInserts) {
+      PCollection<TableRow> successfulInserts,
+      TupleTag<TableDestination> successfulInsertsTag,
+      PCollection<TableDestination> successfulBatchInserts) {
     this.pipeline = pipeline;
     this.failedInsertsTag = failedInsertsTag;
     this.failedInserts = failedInserts;
     this.failedInsertsWithErrTag = failedInsertsWithErrTag;
     this.failedInsertsWithErr = failedInsertsWithErr;
     this.successfulInserts = successfulInserts;
+    this.successfulBatchInsertsTag = successfulInsertsTag;
+    this.successfulBatchInserts = successfulBatchInserts;
+  }
+
+  /**
+   * Returns a {@link PCollection} containing the {@link TableDestinations}s 
that were successfully
+   * inserted.
+   *
+   * <p>Successful Inserts are only produced when using batch inserts.
+   */
+  public PCollection<TableDestination> getSuccessfulBatchInserts() {
+    checkArgument(
+        successfulBatchInsertsTag != null,
+        "Cannot use getSuccessfulInserts because this WriteResult was not 
configured "
+            + "to produce them.  Note: streaming inserts do not produce 
successful "
+            + "insert results.");
+
+    return successfulBatchInserts;

Review comment:
       I'm cool with that, I wonder if we want to remove `batch` from it 
though, since you could in theory use this same method for storage API writes 
if it were implemented, and those aren't technically "batch".  I'm open to 
anything for the name though.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to