[ https://issues.apache.org/jira/browse/BEAM-6695?focusedWorklogId=245585&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-245585 ]
ASF GitHub Bot logged work on BEAM-6695: ---------------------------------------- Author: ASF GitHub Bot Created on: 20/May/19 21:45 Start Date: 20/May/19 21:45 Worklog Time Spent: 10m Work Description: robinyqiu commented on pull request #8206: [BEAM-6695] Latest PTransform for Python SDK URL: https://github.com/apache/beam/pull/8206#discussion_r285780147 ########## File path: sdks/python/apache_beam/transforms/combiners_test.py ########## @@ -392,5 +394,86 @@ def test_global_fanout(self): assert_that(result, equal_to([49.5])) +class LatestTest(unittest.TestCase): + + def test_globally(self): + l = [window.GlobalWindows.windowed_value(3, 100), + window.GlobalWindows.windowed_value(1, 200), + window.GlobalWindows.windowed_value(2, 300)] + with TestPipeline() as p: + pc = p | Create(l) + latest = pc | combine.Latest.Globally() + assert_that(latest, equal_to([2])) + + def test_globally_empty(self): + l = [] + with TestPipeline() as p: + pc = p | Create(l) Review comment: I think we should add an explicit `Map` here as well, similar to what we did below, for the sake of consistency. (This test is passing now only because in the `assert_that` function there is an implicit `Map` transform added to the pipeline.) ---------------------------------------------------------------- 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: 245585) Time Spent: 9h 40m (was: 9.5h) > Latest transform for Python SDK > ------------------------------- > > Key: BEAM-6695 > URL: https://issues.apache.org/jira/browse/BEAM-6695 > Project: Beam > Issue Type: New Feature > Components: sdk-py-core > Reporter: Ahmet Altay > Assignee: Tanay Tummalapalli > Priority: Minor > Time Spent: 9h 40m > Remaining Estimate: 0h > > Add a PTransform} and Combine.CombineFn for computing the latest element in a > PCollection. > It should offer the same API as its Java counterpart: > https://github.com/apache/beam/blob/11a977b8b26eff2274d706541127c19dc93131a2/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Latest.java -- This message was sent by Atlassian JIRA (v7.6.3#76005)