Skip to content
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

ToDos: replace looped subsetVector with subsetDT #5264

Merged
merged 1 commit into from
Dec 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions R/data.table.R
Original file line number Diff line number Diff line change
Expand Up @@ -1301,18 +1301,8 @@ replace_dot_alias = function(e) {
# But rather than that complex logic here at R level to catch that and do a shallow copy for efficiency, just do the check inside CsubsetDT
# to see if it passed 1:nrow(x) and then CsubsetDT should do the shallow copy safely and centrally.
# That R level branch was taken out in PR #3213

# TO DO: use CsubsetDT twice here and then remove this entire R level branch
for (s in seq_along(icols)) {
target = icolsAns[s]
source = icols[s]
ans[[target]] = .Call(CsubsetVector,i[[source]],ii) # i.e. i[[source]][ii]
}
for (s in seq_along(xcols)) {
target = xcolsAns[s]
source = xcols[s]
ans[[target]] = .Call(CsubsetVector,x[[source]],irows) # i.e. x[[source]][irows], but guaranteed new memory even for singleton logicals from R 3.1.0
}
ans[icolsAns] = .Call(CsubsetDT, i, ii, icols)
ans[xcolsAns] = .Call(CsubsetDT, x, irows, xcols)
setattr(ans, "names", ansvars)
if (haskey(x)) {
keylen = which.first(!key(x) %chin% ansvars)-1L
Expand Down