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

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

                Author: ASF GitHub Bot
            Created on: 10/Dec/19 01:56
            Start Date: 10/Dec/19 01:56
    Worklog Time Spent: 10m 
      Work Description: HuangLED commented on pull request #10050: [BEAM-8575] 
Add streaming test case for multi-triggered GBK as side input
URL: https://github.com/apache/beam/pull/10050#discussion_r355809332
 
 

 ##########
 File path: sdks/python/apache_beam/transforms/sideinputs_test.py
 ##########
 @@ -309,6 +316,65 @@ def test_flattened_side_input(self):
     assert_that(results, equal_to(['a', 'b']))
     pipeline.run()
 
+  @attr('ValidatesRunner')
+  def test_multi_triggered_gbk_side_input(self):
+    """Test a GBK sideinput, with multiple triggering."""
+    options = PipelineOptions()
+    options.view_as(StandardOptions).streaming = True
+    p = TestPipeline(options=options)
+
+    main_stream = (p
+                   | 'main TestStream' >> TestStream()
+                   .advance_watermark_to(3)
+                   .add_elements(['a1'])
+                   .advance_watermark_to(8)
+                   .add_elements(['a2'])
+                   | 'main windowInto' >> beam.WindowInto(
+                       window.FixedWindows(5),
+                       trigger=trigger.AfterWatermark(
+                           early=trigger.AfterCount(1)),
+                       accumulation_mode=trigger.AccumulationMode.DISCARDING))
+
+    emit_vals = Map(lambda k_vs: k_vs[1])
+
+    side_stream = (p
+                   | 'side TestStream' >> TestStream()
+                   .add_elements([window.TimestampedValue(('k', 100), 2)])
+                   .add_elements([window.TimestampedValue(('k', 400), 7)])
+                   | 'side windowInto' >> beam.WindowInto(
+                       window.FixedWindows(5),
+                       trigger=trigger.AfterWatermark(
+                           early=trigger.AfterCount(1)),
+                       accumulation_mode=trigger.AccumulationMode.DISCARDING)
+                   | 'GBK' >> beam.GroupByKey()
+                   | 'Values' >> emit_vals)
+
+    class RecordFn(beam.DoFn):
+      def process(self,
+                  elm=beam.DoFn.ElementParam,
+                  ts=beam.DoFn.TimestampParam,
+                  side=beam.DoFn.SideInputParam):
+        yield (elm, ts, side)
+
+    records = (main_stream
+               | beam.ParDo(RecordFn(), beam.pvalue.AsList(side_stream)))
+
+    expected_window_to_elements = {
+        window.IntervalWindow(0, 5): [
+            ('a1', Timestamp(3), [[100]]),
+        ],
+        window.IntervalWindow(5, 10): [
+            ('a2', Timestamp(8), [[400], []])
 
 Review comment:
   issue is gone after using multiple output test stream
 
----------------------------------------------------------------
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:
us...@infra.apache.org


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

    Worklog Id:     (was: 356762)
    Time Spent: 30.5h  (was: 30h 20m)

> Add more Python validates runner tests
> --------------------------------------
>
>                 Key: BEAM-8575
>                 URL: https://issues.apache.org/jira/browse/BEAM-8575
>             Project: Beam
>          Issue Type: Test
>          Components: sdk-py-core, testing
>            Reporter: wendy liu
>            Assignee: wendy liu
>            Priority: Major
>          Time Spent: 30.5h
>  Remaining Estimate: 0h
>
> This is the umbrella issue to track the work of adding more Python tests to 
> improve test coverage.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to