Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test numeric edge case for repartition with npartitions. #5433

Merged

Conversation

amerkel2
Copy link
Contributor

@amerkel2 amerkel2 commented Sep 25, 2019

We had an issue with Dask 1.2.0 where repartitioning a certain number of source partitions into a certain number of target partitions led to one partition missing from the result. In the end, we found that this is because of a numeric instability when determining divisions (dividing and multiplying again with the same number might not always yield exactly the original number, but slightly less, which causes a problem here: https://github.com/dask/dask/blob/master/dask/dataframe/core.py#L5516).

Example:

>>> (15/11)*11
14.999999999999998
>>> int((15/11)*11)
14

With Dask >=2, the problem was fixed by introducing this check: c4b6770#diff-492da7893fa5fa6ad3a6ef6cdef985f2R4821

Nevertheless, it would be safer to preclude any chance of the same bug being introduced again by adding a test, as done by this PR.

  • [ x ] Tests added / passed
  • [ x ] Passes black dask / flake8 dask

@mrocklin mrocklin merged commit 2817533 into dask:master Sep 25, 2019
2 checks passed
@mrocklin
Copy link
Member

@mrocklin mrocklin commented Sep 25, 2019

Thanks for the contribution @amerkel2 . Adding this test seems reasonable to me :)

@amerkel2 amerkel2 deleted the contribution/test_repartition_numeric_edge_case branch Sep 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants