BUG: ensure we use group sizes, not group counts, in transform (GH9697)
Switch count() to size(), so that when we build the expanded values we're using the size of the groups and not simply the number of non-null values they have.  Fixes #9697.
