robertwb commented on a change in pull request #11060: [BEAM-9454] Create 
Deduplication transform based on user timer/state
URL: https://github.com/apache/beam/pull/11060#discussion_r393970454
 
 

 ##########
 File path: sdks/python/apache_beam/runners/portability/fn_api_runner_test.py
 ##########
 @@ -448,6 +449,42 @@ def is_buffered_correctly(actual):
 
       assert_that(actual, is_buffered_correctly)
 
+  def test_deduplication_transform_with_processing_time(self):
+    # Note that current FnApiRunner doesn't respect either real timestamp.
+    with self.create_pipeline() as p:
+      inputs = [
+          window.TimestampedValue('value_1', 1),
+          window.TimestampedValue('value_1', 2),
+          window.TimestampedValue('value_1', 3)
+      ]
+      actual = (
+          p
+          | beam.Create(inputs)
+          | beam.WindowInto(window.FixedWindows(10))
+          | DeduplictaionWithinDuration(duration=timestamp.Duration(5)))
+      assert_that(actual, equal_to(['value_1']))
+
+  @unittest.skip('TestStream not yet supported')
+  def test_deduplication_transform_with_event_time(self):
+    test_stream = (
+        TestStream().advance_watermark_to(0).add_elements([
+            window.TimestampedValue('value_1', 1),
+            window.TimestampedValue('value_1', 2),
+            window.TimestampedValue('value_1', 10)
+        ]).advance_watermark_to(10).add_elements([
+            window.TimestampedValue('value_1', 6)
+        ]).add_elements([window.TimestampedValue('value_2', 15)
+                         ]).advance_watermark_to_infinity())
+
+    with self.create_pipeline() as p:
+      actual = (
+          p
+          | test_stream
+          | DeduplictaionWithinDuration(
+              duration=timestamp.Duration(10),
+              time_domain=userstate.TimeDomain.WATERMARK))
+      assert_that(actual, equal_to(['value_1', 'value_1', 'value_2']))
 
 Review comment:
   The duplication of value_1 probably merits a comment. 

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to