[
https://issues.apache.org/jira/browse/BEAM-10824?focusedWorklogId=478023&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-478023
]
ASF GitHub Bot logged work on BEAM-10824:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 02/Sep/20 18:08
Start Date: 02/Sep/20 18:08
Worklog Time Spent: 10m
Work Description: monicadsong commented on a change in pull request
#12756:
URL: https://github.com/apache/beam/pull/12756#discussion_r482266705
##########
File path: sdks/python/apache_beam/transforms/stats_test.py
##########
@@ -496,6 +483,51 @@ def
test_approximate_unique_globally_by_error_with_skewed_data(self):
equal_to([True]),
label='assert:globally_by_error_with_skewed_data')
+ def test_approximate_unique_combine_fn_by_nondeterministic_coder(self):
+ # test if the combiner throws an error with a nondeterministic coder.
+ sample_size = 30
+ coder = coders.Base64PickleCoder()
+
+ with self.assertRaises(ValueError) as e:
+ _ = ApproximateUniqueCombineFn(sample_size, coder)
+
+ self.assertRegex(
+ e.exception.args[0],
+ 'The key coder "Base64PickleCoder" '
+ 'for ApproximateUniqueCombineFn is not deterministic.')
+
+ def test_approximate_unique_combine_fn_add_values(self):
Review comment:
done.
----------------------------------------------------------------
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: 478023)
Remaining Estimate: 19h 50m (was: 20h)
Time Spent: 4h 10m (was: 4h)
> 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: 4h 10m
> Remaining Estimate: 19h 50m
>
> 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)