Skip to content

Commit 2e5ad96

Browse files
committed
add test case for join result and multiple keys
1 parent 2749ae2 commit 2e5ad96

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

inst/tests/tests.Rraw

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21848,3 +21848,10 @@ d1 = data.table(V1 = c(1L, 0L, 1L), V2 = c("a", "a", "b"), key = "V2")
2184821848
d2 = d1[, .(V1, label = c("one", "zero", "one"), V2)]
2184921849
r = d2[data.table(label = "one"), on = "label", allow.cartesian = TRUE]
2185021850
test(2344.02, nrow(r), 2L)
21851+
# join result of keyed input is the same as unkeyed input
21852+
test(2344.03, setkey(d1[, .(V1, label = c("one", "zero", "one"), V2)][data.table(label = "one"), on = "label", allow.cartesian = TRUE], NULL),
21853+
setkey(d1, NULL)[, .(V1, label = c("one", "zero", "one"), V2)][data.table(label = "one"), on = "label", allow.cartesian = TRUE])
21854+
21855+
# keep subset of multiple keys until no missing key with changing order of key columns
21856+
DT = data.table(V1 = 1:2, V2 = 3:4, V3 = 5:6, key = c("V1", "V2", "V3"))
21857+
test(2344.04, key(DT[, .(V4 = c("b", "a"), V2, V5 = c("y", "x"), V1)]), c("V1", "V2"))

0 commit comments

Comments
 (0)