Skip to content

Commit

Permalink
Patching another issue spotted by Jan. Thanks!
Browse files Browse the repository at this point in the history
  • Loading branch information
arunsrinivasan authored and tangjian.li committed Aug 13, 2017
1 parent 8fea748 commit c6b3aff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/data.table.R
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,7 @@ chmatch2 <- function(x, table, nomatch=NA_integer_) {
# TO DO: port more of this to C
ans = vector("list", length(ansvars))
if (length(i) && length(icols)) {
if (allLen1 && (is.na(nomatch) || !any(f__==0L))) { # nomatch=0 should drop rows in i that have no match
if (allLen1 && nqmaxgrp==1L && (is.na(nomatch) || !any(f__==0L))) { # nomatch=0 should drop rows in i that have no match
for (s in seq_along(icols)) {
target = icolsAns[s]
source = icols[s]
Expand Down
8 changes: 8 additions & 0 deletions inst/tests/tests.Rraw
Original file line number Diff line number Diff line change
Expand Up @@ -8661,6 +8661,14 @@ test(1655.3, dt1[dt2, on=.(x==x)], dt1[dt2, on=c("x"="x")])
test(1655.4, dt1[dt2, on=.(y>=y)], dt1[dt2, on=c("y>=y")])
test(1655.4, dt1[dt2, on=.(x==x, y>=y)], dt1[dt2, on=c("x==x", "y>=y")])

# Patching another issue spotted by Jan
dt = data.table(id="x", a=as.integer(c(3,8,8,15,15,15,16,22,22,25,25)),
b=as.integer(c(9,10,25,19,22,25,38,3,9,7,28)),
c=as.integer(c(22,33,44,14,49,44,40,25,400,52,77)))
set.seed(1L)
dt=dt[sample(.N)][, row_id := 1:.N]
test(1656, nrow(dt[dt, .(x.id, x.a, x.b, x.c, x.row_id, i.id, i.a, i.b, i.c, i.row_id), on = .(c,b<=b,id,a>=a), allow.cartesian = TRUE]), 12L) # just to check that there's no warning

##########################

# TODO: Tests involving GForce functions needs to be run with optimisation level 1 and 2, so that both functions are tested all the time.
Expand Down

0 comments on commit c6b3aff

Please sign in to comment.