[ 
https://issues.apache.org/jira/browse/BEAM-3061?focusedWorklogId=99711&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-99711
 ]

ASF GitHub Bot logged work on BEAM-3061:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 08/May/18 20:31
            Start Date: 08/May/18 20:31
    Worklog Time Spent: 10m 
      Work Description: chamikaramj closed pull request #3997: [BEAM-3061] Done 
notification for BigtableIO.write()
URL: https://github.com/apache/beam/pull/3997
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java
 
b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java
index 47efa08f10d..8ba237e5601 100644
--- 
a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java
+++ 
b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java
@@ -60,10 +60,11 @@
 import org.apache.beam.sdk.transforms.ParDo;
 import org.apache.beam.sdk.transforms.SerializableFunction;
 import org.apache.beam.sdk.transforms.display.DisplayData;
+import org.apache.beam.sdk.transforms.windowing.GlobalWindow;
 import org.apache.beam.sdk.values.KV;
 import org.apache.beam.sdk.values.PBegin;
 import org.apache.beam.sdk.values.PCollection;
-import org.apache.beam.sdk.values.PDone;
+import org.joda.time.Instant;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -434,7 +435,7 @@ BigtableService getBigtableService(PipelineOptions 
pipelineOptions) {
   @Experimental(Experimental.Kind.SOURCE_SINK)
   @AutoValue
   public abstract static class Write
-      extends PTransform<PCollection<KV<ByteString, Iterable<Mutation>>>, 
PDone> {
+      extends PTransform<PCollection<KV<ByteString, Iterable<Mutation>>>, 
PCollection<Void>> {
 
     /** Returns the table being written to. */
     @Nullable
@@ -516,18 +517,17 @@ public Write withTableId(String tableId) {
     }
 
     @Override
-    public PDone expand(PCollection<KV<ByteString, Iterable<Mutation>>> input) 
{
+    public PCollection<Void> expand(PCollection<KV<ByteString, 
Iterable<Mutation>>> input) {
       checkArgument(getBigtableOptions() != null, "withBigtableOptions() is 
required");
       checkArgument(getTableId() != null && !getTableId().isEmpty(), 
"withTableId() is required");
 
-      input.apply(ParDo.of(new BigtableWriterFn(getTableId(),
+      return input.apply(ParDo.of(new BigtableWriterFn(getTableId(),
           new SerializableFunction<PipelineOptions, BigtableService>() {
         @Override
         public BigtableService apply(PipelineOptions options) {
           return getBigtableService(options);
         }
       })));
-      return PDone.in(input.getPipeline());
     }
 
     @Override
@@ -630,10 +630,11 @@ public void processElement(ProcessContext c) throws 
Exception {
       }
 
       @FinishBundle
-      public void finishBundle() throws Exception {
+      public void finishBundle(FinishBundleContext c) throws Exception {
         bigtableWriter.flush();
         checkForFailures();
         LOG.info("Wrote {} records", recordsWritten);
+        c.output(null, Instant.now(), GlobalWindow.INSTANCE);
       }
 
       @Teardown


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 99711)
    Time Spent: 20m  (was: 10m)

> BigtableIO should support emitting a sentinel "done" value when a bundle 
> completes
> ----------------------------------------------------------------------------------
>
>                 Key: BEAM-3061
>                 URL: https://issues.apache.org/jira/browse/BEAM-3061
>             Project: Beam
>          Issue Type: Improvement
>          Components: io-java-gcp
>            Reporter: Steve Niemitz
>            Assignee: Steve Niemitz
>            Priority: Major
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> There was some discussion of this on the dev@ mailing list [1].  This 
> approach was taken based on discussion there.
> [1] 
> https://lists.apache.org/thread.html/949b33782f722a9000c9bf9e37042739c6fd0927589b99752b78d7bd@%3Cdev.beam.apache.org%3E



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to