tvalentyn commented on code in PR #29542:
URL: https://github.com/apache/beam/pull/29542#discussion_r1410025571


##########
sdks/python/apache_beam/ml/transforms/handlers.py:
##########
@@ -134,7 +135,9 @@ def process(self, element):
         hash_object.update(str(list(value)).encode())
       else:  # assume value is a primitive that can be turned into str
         hash_object.update(str(value).encode())
-    yield (hash_object.hexdigest(), element)
+    # add a unique suffix to the hash key to avoid collisions.
+    unique_suffix = uuid.uuid4().hex

Review Comment:
   also if keys can be `bytes` instead of `str`, using raw bytes instead of 
hash would cut key size in ~half



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to