BUG: Aggregation with mixed reduction datatypes (array, scalar, etc) fails on Dask backend #2820
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Using
.aggregate()with a reduction that outputs an array + a reduction that outputs a scalar fails on the Dask backend.When executing
.aggregate(), Dask computes the individual reductions, then concatenates them together to form a single DataFrame.In this case, Dask does not want to concatenate the results of the two reductions because one has known divisions, and the other has unknown divisions:
dd.from_delayedincoerce_to_output: util.py#L128-L130coerce_to_outputusingdd.from_pandas: util.py#L134-L136.Solution
In this PR, we change our use of
dd.from_delayedincoerce_to_outputto manually specify the divisions. Since the divisions are now always known, Dask will be able to concatenate the results of the individual reductions together.