-
Notifications
You must be signed in to change notification settings - Fork 985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixing crash when attempting to join on character(0) #4272
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d0fd094
Fixed crash when attempting to join on character(0)
tlapak 2e185f6
Minor grammar fix in error message
tlapak a3e0e62
Atted test for crash when attempting to join on character(0)
tlapak e85e836
Added news entry
tlapak 3e5ae0b
Reflect grammar change to error message in tests
tlapak bdfb694
Added link to news file linking the PR
tlapak cba5c55
Add check in bmerge.c
tlapak 008e472
Add tests for check in bmerge.c
tlapak 153f712
Update to pass 2126.*
tlapak 04cedfd
Expand tests 2126
tlapak 91ec306
Merge branch 'master' into fix_join_crash
tlapak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,8 +21,8 @@ merge.data.table = function(x, y, by = NULL, by.x = NULL, by.y = NULL, all = FAL | |
if (!missing(by) && !missing(by.x)) | ||
warning("Supplied both `by` and `by.x/by.y`. `by` argument will be ignored.") | ||
if (!is.null(by.x)) { | ||
if ( !is.character(by.x) || !is.character(by.y)) | ||
stop("A non-empty vector of column names are required for `by.x` and `by.y`.") | ||
if (length(by.x) == 0L || !is.character(by.x) || !is.character(by.y)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aha! I was just looking at this code yesterday and something looked funny but I didn't bother stress testing it. nice catch! |
||
stop("A non-empty vector of column names is required for `by.x` and `by.y`.") | ||
if (!all(by.x %chin% names(x))) | ||
stop("Elements listed in `by.x` must be valid column names in x.") | ||
if (!all(by.y %chin% names(y))) | ||
|
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, perfect. we also shouldn't have gotten to checking by.x&by.y separately in the first place because here by.x=by.y so simply by should be used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not quite sure what you mean. At this point we're not checking separately if we come through merge. merge sets by=by.x and then later calls y[x, on=by]. If we don't check in merge we catch it here but this is the point where it gets caught when using x[y] syntax.
(I would've been really mad if you had pushed a fix yesterday.)