You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by GitBox <gi...@apache.org> on 2020/03/02 17:24:06 UTC

[GitHub] [beam] kennknowles commented on a change in pull request #10972: Add DeduplicationByUniqueId transform

kennknowles commented on a change in pull request #10972: Add DeduplicationByUniqueId transform
URL: https://github.com/apache/beam/pull/10972#discussion_r386535161
 
 

 ##########
 File path: sdks/python/apache_beam/runners/portability/fn_api_runner_test.py
 ##########
 @@ -543,6 +545,15 @@ def process(
       self.assertEqual(1, len(counters))
       self.assertEqual(counters[0].committed, len(''.join(data)))
 
+  def test_deduplication_by_id(self):
+    with self.create_pipeline() as p:
+      res = (p
+             | beam.Create([('id_1', 'value_1'),
+                            ('id_2', 'value_2'),
+                            ('id_1', 'value_1')])
+             | DeduplicationByUniqueId())
 
 Review comment:
   I understand. It does allow inconsistency but not too much risk since anyone will immediately see that a key might have two values and they have to be careful. FWIW in Java is it arranged slightly differently into [`Distinct.withRepresentativeValues`](https://github.com/apache/beam/blob/master/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Distinct.java#L81). But that way is not as cross-language-friendly as precomputing the keys. 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services