Skip to content

Commit

Permalink
Closes #1819. bmerge timing shown in inrange() when verbose is on
Browse files Browse the repository at this point in the history
  • Loading branch information
arunsrinivasan committed Aug 19, 2016
1 parent 3bb5609 commit 326a155
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@

34. `%between%` is vectorised which means we can now do: `DT[x %between% list(y,z)]` which is equivalent to `DT[x >= y & x <= z]`, [#534](https://github.com/Rdatatable/data.table/issues/534). Thanks @MicheleCarriero for filing the issue and the idea.

35. New functions `inrange()` and `%inrange%` are exported. It performs a range join making use of the recently implemented `non-equi` joins ([#1452](https://github.com/Rdatatable/data.table/issues/1452)) [#679](https://github.com/Rdatatable/data.table/issues/679).
35. New functions `inrange()` and `%inrange%` are exported. It performs a range join making use of the recently implemented `non-equi` joins ([#1452](https://github.com/Rdatatable/data.table/issues/1452)) [#679](https://github.com/Rdatatable/data.table/issues/679). Also thanks to @DavidArenburg for [#1819](https://github.com/Rdatatable/data.table/issues/1819).

36. `rbindlist` supports columns of type `complex`, [#1659](https://github.com/Rdatatable/data.table/issues/1659).

Expand Down
2 changes: 1 addition & 1 deletion R/between.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ inrange <- function(x,lower,upper,incbounds=TRUE) {
ops = if (incbounds) c(4L, 2L) else c(5L, 3L) # >=,<= and >,<
ans = bmerge(shallow(subject), query, 1:2, c(1L,1L), FALSE, xo <- forderv(query),
0, c(FALSE, TRUE), 0L, "all", ops, integer(0),
1L, FALSE)
1L, getOption("datatable.verbose")) # fix for #1819, turn on verbose messages
setDT(ans[c("starts", "lens")], key=c("starts", "lens"))
.Call(Cinrange, idx <- rep(FALSE, length(x)), xo, ans[["starts"]], ans[["lens"]])
idx
Expand Down
8 changes: 8 additions & 0 deletions inst/tests/tests.Rraw
Original file line number Diff line number Diff line change
Expand Up @@ -9135,6 +9135,14 @@ test(1695.2, x %between% c(NA, 7), c(NA, NA, NA, NA, NA, FALSE))
test(1695.3, x %between% c(3, NA), c(NA, NA, FALSE, NA, FALSE, NA))
test(1695.4, x %between% c(NA, NA), rep(NA, 6L))

# test for #1819, verbose message for bmerge
old_opt = getOption("datatable.verbose")
options(datatable.verbose = TRUE)
x = data.table(A = 10:17)
test(1696.0, grepl("bmerge", capture.output(DT[A %inrange% 13:14])[1L]), TRUE)
# restore verbosity
options(datatable.verbose = old_opt)

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

# 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 326a155

Please sign in to comment.