[
https://issues.apache.org/jira/browse/BEAM-10824?focusedWorklogId=480464&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-480464
]
ASF GitHub Bot logged work on BEAM-10824:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 08/Sep/20 22:00
Start Date: 08/Sep/20 22:00
Worklog Time Spent: 10m
Work Description: tvalentyn commented on a change in pull request #12756:
URL: https://github.com/apache/beam/pull/12756#discussion_r485218862
##########
File path: sdks/python/apache_beam/transforms/stats.py
##########
@@ -46,6 +57,35 @@
V = typing.TypeVar('V')
+def _default_hash_fn(value):
+ """Hash value using either murmurhash or md5 based on installation."""
+ if not _default_hash_fn.fn:
+ try:
+ import mmh3 # pylint: disable=import-error
+
+ def _mmh3_hash(value):
+ # mmh3.hash64 returns 2 64-bit unsigned integers
+ return mmh3.hash64(value, seed=0, signed=False)[0]
+
+ _default_hash_fn.fn = _mmh3_hash
+ except ImportError:
+ logging.warning(
+ 'Couldn\'t find murmurhash so the implementation of '
+ 'ApproximateUnique is not as fast as it could be.')
Review comment:
`Couldn't find murmurhash. Install mmh3 for a faster implementation of
ApproximateUnique.`
----------------------------------------------------------------
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]
Issue Time Tracking
-------------------
Worklog Id: (was: 480464)
Remaining Estimate: 12h 10m (was: 12h 20m)
Time Spent: 11h 50m (was: 11h 40m)
> Hash in stats.ApproximateUniqueCombineFn NON-deterministic
> ----------------------------------------------------------
>
> Key: BEAM-10824
> URL: https://issues.apache.org/jira/browse/BEAM-10824
> Project: Beam
> Issue Type: Bug
> Components: sdk-py-core
> Reporter: Monica Song
> Priority: P1
> Labels: hash
> Original Estimate: 24h
> Time Spent: 11h 50m
> Remaining Estimate: 12h 10m
>
> The python hash() function is non-deterministic. As a result, different
> workers will map identical values to different hashes. This leads to
> overestimation of the number of unique values (by several magnitudes, in my
> experience x1000) in a distributed processing model.
> [https://github.com/apache/beam/blob/master/sdks/python/apache_beam/transforms/stats.py#L218]
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)