[
https://issues.apache.org/jira/browse/BEAM-8575?focusedWorklogId=357382&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-357382
]
ASF GitHub Bot logged work on BEAM-8575:
----------------------------------------
Author: ASF GitHub Bot
Created on: 10/Dec/19 20:06
Start Date: 10/Dec/19 20:06
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_r356251513
##########
File path: sdks/python/apache_beam/transforms/sideinputs_test.py
##########
@@ -309,6 +316,66 @@ 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)
+
+ test_stream = (p
+ | 'Mixed TestStream' >> TestStream()
+ .advance_watermark_to(3, tag='main')
+ .add_elements(['a1'], tag='main')
+ .advance_watermark_to(8, tag='main')
+ .add_elements(['a2'], tag='main')
+ .add_elements([window.TimestampedValue(('k', 100), 2)],
+ tag='side')
+ .add_elements([window.TimestampedValue(('k', 400), 7)],
+ tag='side')
+ .advance_watermark_to_infinity(tag='main')
+ .advance_watermark_to_infinity(tag='side'))
+
+ main_data = (test_stream['main']
+ | 'Main windowInto' >> beam.WindowInto(
+ window.FixedWindows(5),
+ accumulation_mode=trigger.AccumulationMode.DISCARDING))
+
+ side_data = (test_stream['side']
+ | 'Side windowInto' >> beam.WindowInto(
+ window.FixedWindows(5),
+ trigger=trigger.AfterWatermark(
+ early=trigger.AfterCount(1)),
+ accumulation_mode=trigger.AccumulationMode.DISCARDING)
+ | beam.CombinePerKey(sum)
+ | 'Values' >> Map(lambda k_vs: k_vs[1]))
+
+ 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_data
+ | beam.ParDo(RecordFn(), beam.pvalue.AsList(side_data)))
+
+ expected_window_to_elements = {
+ window.IntervalWindow(0, 5): [
+ ('a1', Timestamp(3), [100, 0]),
Review comment:
Thanks for confirming the behavior.
This extra '0' is expected because default behavior of firing emits an
empty pane when window closes.
After looking into core.py, looks like EMIT_IF_NONEMPTY is not supported
yet. Link:
https://github.com/apache/beam/blob/master/sdks/python/apache_beam/transforms/core.py#L2308
; Given this, let us leave this testing scenario as is.
----------------------------------------------------------------
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: 357382)
Time Spent: 31h 20m (was: 31h 10m)
> 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: 31h 20m
> 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)