[
https://issues.apache.org/jira/browse/BEAM-1450?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15860142#comment-15860142
]
ASF GitHub Bot commented on BEAM-1450:
--------------------------------------
GitHub user robertwb opened a pull request:
https://github.com/apache/beam/pull/1965
[BEAM-1450] Fix NewDoFn handling of window explosion.
Be sure to do all of the following to help us incorporate your contribution
quickly and easily:
- [ ] Make sure the PR title is formatted like:
`[BEAM-<Jira issue #>] Description of pull request`
- [ ] Make sure tests pass via `mvn clean verify`. (Even better, enable
Travis-CI on your fork and ensure the whole test matrix passes).
- [ ] Replace `<Jira issue #>` in the title with the actual Jira issue
number, if there is one.
- [ ] If this contribution is large, please file an Apache
[Individual Contributor License
Agreement](https://www.apache.org/licenses/icla.txt).
---
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/robertwb/incubator-beam newdofn-windows
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/beam/pull/1965.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1965
----
commit a7b5fe559e3796c2b31aa55ddb8ff2b4566f6a00
Author: Robert Bradshaw <[email protected]>
Date: 2017-02-09T20:18:48Z
[BEAM-1450] Fix NewDoFn handling of window explosion.
----
> NewDoFn does not properly explode windows
> -----------------------------------------
>
> Key: BEAM-1450
> URL: https://issues.apache.org/jira/browse/BEAM-1450
> Project: Beam
> Issue Type: Bug
> Components: sdk-py
> Reporter: Robert Bradshaw
> Assignee: Robert Bradshaw
>
> A window-taking DoFn's process gets called once per window, but each output
> gets placed into all windows.
> E.g. the following test fails
> {code}
> def test_window_param(self):
> class TestDoFn(DoFn):
> def process(self, element, window=DoFn.WindowParam):
> yield (element, (float(window.start), float(window.end)))
> pipeline = TestPipeline()
> pcoll = (pipeline
> | Create([1, 7])
> | Map(lambda x: TimestampedValue(x, x))
> | WindowInto(windowfn=SlidingWindows(10, 5))
> | ParDo(TestDoFn()))
> assert_that(pcoll, equal_to([(1, (-5, 5)), (1, (0, 10)),
> (7, (0, 10)), (7, (5, 15))]))
> pcoll2 = pcoll | 'Again' >> ParDo(TestDoFn())
> assert_that(
> pcoll2,
> equal_to([
> ((1, (-5, 5)), (-5, 5)), ((1, (0, 10)), (0, 10)),
> ((7, (0, 10)), (0, 10)), ((7, (5, 15)), (5, 15))]),
> label='doubled windows')
> pipeline.run()
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)