Fixes nonlocal reducers in which the first list is empty. #1378
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.
This error was reported in #1371, and the fix is in the kernel:
The initial value of
maxdistinct
is supposed to be different from all possible values so that the first item is identified as a distinct list, but empty lists are represented in thedistincts
array as-1
. Setting the initial value to a smaller number allows it to trigger on the first list, even if that list is empty.This bug goes way back: in the first implementation of this kernel (Feb 15 2020)
https://github.com/scikit-hep/awkward-1.0/blob/b4ea752b641e1162e6e3ac9b2778ac544a52d5ff/src/cpu-kernels/reducers.cpp#L462-L466
and the studies that preceded it
https://github.com/scikit-hep/awkward-1.0/blob/fd94fd6978e06795f2a36aefa8b1bc2a7772387e/studies/reducers.py#L1014-L1018
Thanks, @masonproffitt!