Fixed subsetting / join bug with keys and factor to character coercion.#2926
Merged
Fixed subsetting / join bug with keys and factor to character coercion.#2926
Conversation
jangorecki
approved these changes
Jun 14, 2018
| io = if (missing(on)) haskey(i) else identical(unname(on), head(key(i), length(on))) | ||
| i = .shallow(i, retain.key = io) | ||
| ans = bmerge(i, x, leftcols, rightcols, io, xo, roll, rollends, nomatch, mult, ops, nqgrp, nqmaxgrp, verbose=verbose) | ||
| i = .shallow(i, retain.key = TRUE) |
Member
There was a problem hiding this comment.
this change of dynamic value to TRUE does not impose any more changes to bmerge and Cbmerge?
Contributor
Author
There was a problem hiding this comment.
I strongly believe so. Cbmerge just accepts a bool for the io argument telling if i is ordered. If not, it calls forderv. bmerge.R used to accept any existing key on i as valid for the current join without crosscheck. Now, it carefully tests if the key on i is appropriate for the problem at hand. Therefore, the now always retained key on i should make no difference IMHO.
mattdowle
approved these changes
Aug 17, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 #2881.
Unfortunately, my PR #2389, that introduced partial key retainment when assigning to columns, introduced a regression in
bmerge.R.bmerge.Rassumed implicitely that anyset()operation removes a key completely if it assigns to a key column. In contrast, the mentioned PR made it possible that a reduced key still exists when assigning to a key column.I have done the following:
bmerge.Rso that it checks internally if the key oniis correct, instead of using theioargument. This was also mentioned as a TODO inbmerge.Rsourcecode.ioargument), so I changed all calls tobmerge.R.sortedattribute at the end ofdata.table.Rhad to be modified.No existing tests were modified and a new test added.
This regression should occur very rarely, but if it does, it is very bad. Therefore, it might make sense to issue a quick bugfix release to CRAN rather soon?