Disallow access to group columns in expand()
and complete()
#1300
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.
Closes #1299
Follow up to #1289
In #1289 we added a grouped-df method for
complete()
that callscomplete()
"within" each group. This would send the entire group slice of data (including the grouping column) into the inner call tocomplete()
. This turns out to be buggy, since it can generate missing values in the grouping columns if the within-group-expansion adds rows:We never saw this with
expand()
, because each call toexpand()
"within" each group would only return the expansion columns, then the outersummarize()
would add the group columns back on.Compare this with
complete()
, where each inner call tocomplete()
"within" each group returns all the columns in the data frame. This includes the grouping columns if they are passed through, andsummarize()
won't overwrite those, which is why we ended up with the problem above.The fix is to use
cur_data()
rather thancur_data_all()
, forcingsummarize()
to handle the re-addition of any group columns. This means you can no longer attempt to "complete" or "expand" on a group column, but that was pretty much undefined behavior previously, since conceptually you should be completing/expanding "within" each group, meaning you don't have access to that group info.