Skip to content

fix: Permute the group bitmap with the data in sliceGroups - #219

Open
SamuelSchlesinger wants to merge 2 commits into
DataHaskell:mainfrom
SamuelSchlesinger:fix/grouped-agg-nullable-bitmap
Open

fix: Permute the group bitmap with the data in sliceGroups#219
SamuelSchlesinger wants to merge 2 commits into
DataHaskell:mainfrom
SamuelSchlesinger:fix/grouped-agg-nullable-bitmap

Conversation

@SamuelSchlesinger

Copy link
Copy Markdown

sliceGroups backpermutes the values into group order but slices the original, unpermuted bitmap, so nulls get attributed to whatever rows sit at those positions after sorting. A grouped sumMaybe over interleaved keys sums the wrong rows.

Permute the bitmap with the same index vector before slicing. Two tests pin it (nulls in one group / nulls in every group).

sliceGroups permutes a column's data into group order but slices the
null bitmap at the group's offsets in the original row order, so a
group's values and its validity bits come from different rows unless the
frame already happens to be sorted by the key.

Both cases use interleaved keys so valueIndices is not the identity
permutation. Currently the first reports a=4.0 for a group summing to
10.0; the second mis-attributes nulls in both groups.
The data was backpermuted into group order while the bitmap was sliced
at the group's offsets in the original row order, so values and validity
bits came from different rows unless the frame was already sorted by the
key. Permute the bitmap by the same indices, once, before slicing.
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.

1 participant