Skip to content

Empty arr rechunk#6233

Merged
jcrist merged 4 commits intodask:masterfrom
andrewfulton9:empty_arr_rechunk
May 27, 2020
Merged

Empty arr rechunk#6233
jcrist merged 4 commits intodask:masterfrom
andrewfulton9:empty_arr_rechunk

Conversation

@andrewfulton9
Copy link
Contributor

Currently if you try to rechunk an empty array, you will get caught in an infinite loop. This PR fixes that by simply returning the array when the rechunk method is called if shape == (0,).

Example of failing code:

import dask.array as da

array = da.array([])
array.rechunk()
  • Tests added / passed
  • Passes black dask / flake8 dask

Copy link
Member

@jrbourbeau jrbourbeau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @andrewfulton9! The current set of changes definitely fix things for the 1-d case. But I'm still observing hanging behavior when re-chunking an empty array which is greater than 1-d. For example:

import dask.array as da

array = da.array([[], []])
array.rechunk()

Perhaps instead of exiting early if x.shape == (0,), we could avoid re-chunking any axis with a length of 0?

@andrewfulton9
Copy link
Contributor Author

Ah good point, I should have checked multidimensional arrays. I'll get that fixed up

@jrbourbeau
Copy link
Member

No worries! Thanks for taking on the multidimensional case too

Also, apologies for the numba-related CI test failures. They're unrelated and are being addressed in #6236.

@jcrist
Copy link
Member

jcrist commented May 27, 2020

LGTM, thanks @andrewfulton9! Merging.

@jcrist jcrist merged commit 77628f2 into dask:master May 27, 2020
galipremsagar pushed a commit to galipremsagar/dask that referenced this pull request May 29, 2020
* fixes rechunk infinite loop

* fixes formatting

* removes debugging print statements

* changes to deal with multidimensional empty arrays
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.

3 participants