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

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

                Author: ASF GitHub Bot
            Created on: 20/Jun/19 19:03
            Start Date: 20/Jun/19 19:03
    Worklog Time Spent: 10m 
      Work Description: jkff commented on pull request #7805: [BEAM-3061] Done 
notifications for BigtableIO.Write
URL: https://github.com/apache/beam/pull/7805#discussion_r295952808
 
 

 ##########
 File path: 
sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIOTest.java
 ##########
 @@ -1159,6 +1167,62 @@ public void testWriting() throws Exception {
     assertEquals(ByteString.copyFromUtf8(value), 
rows.get(ByteString.copyFromUtf8(key)));
   }
 
+  /** Tests that at least one result is emitted per element written in the 
global window. */
+  @Test
+  public void testWritingEmitsResultsWhenDoneInGlobalWindow() throws Exception 
{
+    final String table = "table";
+    final String key = "key";
+    final String value = "value";
+
+    service.createTable(table);
+
+    PCollection<BigtableWriteResult> results =
+        p.apply("single row", Create.of(makeWrite(key, 
value)).withCoder(bigtableCoder))
+            .apply("write", defaultWrite.withTableId(table));
+    PAssert.that(results)
+        .inWindow(GlobalWindow.INSTANCE)
+        .containsInAnyOrder(BigtableWriteResult.create(1));
+
+    p.run();
+  }
+
+  /** Tests that at least one result is emitted per element written in each 
window. */
+  @Test
+  public void testWritingEmitsResultsWhenDoneInFixedWindow() throws Exception {
+    final String table = "table";
+    final String key = "key";
+    final String value = "value";
+
+    service.createTable(table);
+
+    Instant elementTimestamp = Instant.parse("2019-06-10T00:00:00");
+    Duration windowDuration = Duration.standardMinutes(1);
+
+    TestStream<KV<ByteString, Iterable<Mutation>>> input =
+        TestStream.create(bigtableCoder)
+            .advanceWatermarkTo(elementTimestamp)
+            .addElements(makeWrite(key, value))
+            .advanceWatermarkTo(elementTimestamp.plus(windowDuration))
+            .addElements(makeWrite(key, value))
+            .advanceWatermarkToInfinity();
+
+    BoundedWindow expectedFirstWindow = new IntervalWindow(elementTimestamp, 
windowDuration);
+    BoundedWindow expectedSecondWindow = new IntervalWindow(elementTimestamp, 
windowDuration);
+
+    PCollection<BigtableWriteResult> results =
 
 Review comment:
   I think you don't need TestStream for this test, you just need 
Create.timestamped().
   
   Would be good to also make this test a little more involved to catch the 
issue with correct counting per window.
 
----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


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

    Worklog Id:     (was: 264028)
    Time Spent: 10h 10m  (was: 10h)

> 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: 10h 10m
>  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