-
Notifications
You must be signed in to change notification settings - Fork 992
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
fix incorrect key when one and only one NA is at the beginning #3443
Conversation
R/data.table.R
Outdated
if (keylen && (ichk || is.logical(i) || (.Call(CisOrderedSubset, irows, nrow(x)) && ((roll == FALSE) || length(irows) == 1L)))) # see #1010. don't set key when i has no key, but irows is ordered and roll != FALSE | ||
if (keylen && ( | ||
ichk || is.logical(i) || ( | ||
.Call(CisOrderedSubset, irows, nrow(x)) && !missingroll && ( # !missingroll fix for #3441 |
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.
might not be clear due to reformatting... only !missingroll
has been added here
@@ -1248,17 +1248,21 @@ SEXP isOrderedSubset(SEXP x, SEXP nrow) | |||
// specialized for use in [.data.table only | |||
// Ignores 0s but heeds NAs and any out-of-range (which result in NA) |
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.
what was designed behaviour for NA based on that comment? it it will return FALSE for any NA, which solves the issue, and does not break any tests
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.
The behaviour intended was to heed NAs; meaning NAs anywhere should return FALSE. It was getting it wrong then when there is one NA at the beginning. Good spot and fix.
Codecov Report
@@ Coverage Diff @@
## master #3443 +/- ##
==========================================
+ Coverage 95.11% 95.13% +0.02%
==========================================
Files 65 65
Lines 12310 12303 -7
==========================================
- Hits 11709 11705 -4
+ Misses 601 598 -3
Continue to review full report at Codecov.
|
closes #3441.
Adds some overhead to C
isOrderedSubset
function which is called in few places, so best to confirm there is no faster way. And that it is the proper way to solve that at all.