-
Notifications
You must be signed in to change notification settings - Fork 996
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
by = .EACHI key fix 4603 #4917
by = .EACHI key fix 4603 #4917
Changes from 8 commits
b2bb32b
a57a9b0
0b92313
861e7d5
c7c32ca
784c0d3
fa69e15
4e4af45
6cecfdf
8c658b2
d19260b
81e13ec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1385,7 +1385,8 @@ replace_dot_alias = function(e) { | |
byval = i | ||
bynames = if (missing(on)) head(key(x),length(leftcols)) else names(on) | ||
allbyvars = NULL | ||
bysameorder = haskey(i) || (is.sorted(f__) && ((roll == FALSE) || length(f__) == 1L)) # Fix for #1010 | ||
bysameorder = (haskey(i) && identical(leftcols, head(match(key(i),names(i)), length(leftcols)))) || # leftcols leading subset of key(i); see #4917 | ||
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. is there a reason for identical() over all( . == . ) here? identical is a heavier test including things like attributes right? also at a glance I would do head() before match() 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. Good point. Yep 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. caveat ... |
||
(roll==FALSE && is.sorted(f__)) # roll==FALSE is fix for #1010 | ||
## 'av' correct here ?? *** TO DO *** | ||
xjisvars = intersect(av, names_x[rightcols]) # no "x." for xvars. | ||
# if 'get' is in 'av' use all cols in 'i', fix for bug #34 | ||
|
@@ -1833,7 +1834,7 @@ replace_dot_alias = function(e) { | |
setkeyv(ans,names(ans)[seq_along(byval)]) | ||
if (verbose) {cat(timetaken(last.started.at),"\n"); flush.console()} | ||
} else if (keyby || (haskey(x) && bysameorder && (byjoin || (length(allbyvars) && identical(allbyvars,head(key(x),length(allbyvars))))))) { | ||
setattr(ans,"sorted",names(ans)[seq_along(grpcols)]) | ||
setattr(ans,"sorted",names(ans)[seq_along(grpcols)]) | ||
} | ||
setalloccol(ans) # TODO: overallocate in dogroups in the first place and remove this line | ||
} | ||
|
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 removed the
length(f__)==1L
too. That was there, iiuc, from before #3443 whenis.sorted()
returned false for a single NA. Sinceis.sorted()
is true for all length 1 input, the|| length(f__)==1L
is superfluous now.Also moved the
roll=FALSE
first before&& is.sorted(f__)
to save the call tois.sorted()
whenroll==TRUE
.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.
chmatch
notmatch
too. i can fix if you're AFK now.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.
good spot. done.
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.
btw, I thought we had a
isLeadingSubsetOfKey()
helper function, or similar name, as we do that op quite a bit. But when I did a few greps I couldn't find anything.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 was exactly thinking that we should just have a helper for this by now...