Skip to content

Commit 6ff4af6

Browse files
Don't attempt reuseSorting on non-data.table in bmerge (#6502)
1 parent 9443409 commit 6ff4af6

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ rowwiseDT(
7171

7272
12. Using a namespace-qualified call on the RHS of `by=`, e.g. `DT[,.N,by=base::mget(v)]`, works again, fixing [#6493](https://github.com/Rdatatable/data.table/issues/6493). Thanks to @mmoisse for the report and @MichaelChirico for the fix.
7373

74+
13. Restore some join operations on `x` and `i` (e.g. an anti-join `x[!i]`) where `i` is an extended data.frame, but not a data.table (e.g. a `tbl`), [#6501](https://github.com/Rdatatable/data.table/issues/6501). Thanks @MichaelChirico for the report and PR.
75+
7476
## NOTES
7577

7678
1. Tests run again when some Suggests packages are missing, [#6411](https://github.com/Rdatatable/data.table/issues/6411). Thanks @aadler for the note and @MichaelChirico for the fix.

inst/tests/tests.Rraw

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19268,3 +19268,10 @@ test(2291.1, set(df, NULL, "new", "new"), error="attributes .* have been reassig
1926819268
DT = data.table(a = 1)
1926919269
test(2292.1, DT[, .N, by=base::mget("a")], data.table(a = 1, N = 1L))
1927019270
test(2292.2, DT[, .N, by=base::c("a")], data.table(a = 1, N = 1L))
19271+
19272+
# don't try to re-use sorting on a non-data.table, #6501
19273+
x = data.table(id = "aaa")
19274+
y = data.frame(id = "bbb")
19275+
test(2293.1, x[!y, on='id'], x)
19276+
class(y) = c("tbl_df", "tbl", "data.frame")
19277+
test(2293.2, x[!y, on = "id"], x)

src/bmerge.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ SEXP bmerge(SEXP idt, SEXP xdt, SEXP icolsArg, SEXP xcolsArg, SEXP xoArg, SEXP r
160160
protecti += 2;
161161

162162
SEXP ascArg = PROTECT(ScalarInteger(1));
163-
SEXP oSxp = PROTECT(forderReuseSorting(idt, icolsArg, /* retGrpArg= */ScalarLogical(FALSE), /* retStatsArg= */ScalarLogical(FALSE), /* sortGroupsArg= */ScalarLogical(TRUE), ascArg, /* naArg= */ScalarLogical(FALSE), /* reuseSortingArg= */ScalarLogical(TRUE))); protecti++;
163+
SEXP reuseSortingArg = INHERITS(idt, char_datatable) ? ScalarLogical(TRUE) : ScalarLogical(FALSE);
164+
SEXP oSxp = PROTECT(forderReuseSorting(idt, icolsArg, /* retGrpArg= */ScalarLogical(FALSE), /* retStatsArg= */ScalarLogical(FALSE), /* sortGroupsArg= */ScalarLogical(TRUE), ascArg, /* naArg= */ScalarLogical(FALSE), reuseSortingArg)); protecti++;
164165
UNPROTECT(2); // down stack to 'ascArg'
165166
PROTECT(oSxp);
166167

0 commit comments

Comments
 (0)