[
https://issues.apache.org/jira/browse/BEAM-8575?focusedWorklogId=342784&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-342784
]
ASF GitHub Bot logged work on BEAM-8575:
----------------------------------------
Author: ASF GitHub Bot
Created on: 13/Nov/19 18:49
Start Date: 13/Nov/19 18:49
Worklog Time Spent: 10m
Work Description: lukecwik commented on pull request #9957: [BEAM-8575]
Test a customized window fn work as expected
URL: https://github.com/apache/beam/pull/9957#discussion_r345935518
##########
File path: sdks/python/apache_beam/transforms/window_test.py
##########
@@ -65,6 +66,30 @@ def process(self, element, window=core.DoFn.WindowParam):
reify_windows = core.ParDo(ReifyWindowsFn())
+class TestCustomWindows(FixedWindows):
+ """A custom non merging window fn which assigns elements into interval
windows
+ [0, 3), [3, 5) and [5, element timestamp) based on the element timestamps.
+ """
+
+ def __init__(self, size=1, offset=1):
+ super(TestCustomWindows, self).__init__(size, offset)
+
+ def assign(self, context):
+ timestamp = context.timestamp
+ if timestamp < 3:
+ return [IntervalWindow(0, 3)]
+ elif timestamp < 5:
+ return [IntervalWindow(3, 5)]
+ else:
+ return [IntervalWindow(5, timestamp)]
+
+ @urns.RunnerApiFn.register_urn(
+ common_urns.fixed_windows.urn,
+ standard_window_fns_pb2.FixedWindowsPayload)
+ def from_runner_api_parameter(fn_parameter, unused_context):
Review comment:
@robertwb did say that the default for to/from proto methods was to have it
pickled so do we need to have this at all?
----------------------------------------------------------------
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: 342784)
Time Spent: 4h 50m (was: 4h 40m)
> 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: 4h 50m
> 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)