@@ -8563,26 +8563,21 @@ test(1600.2, names(DT1[DT2, .(id1=id1, val=val, bla=sum(z1, na.rm=TRUE)), on="id
85638563
85648564# warn when merge empty data.table #597
85658565DT0 = data.table(NULL)
8566- DT1 = data.table(a=1)
8567-
8568- # Test 1601.1: Merge DT1 with itself on column 'a'
8569- test(1601.1, merge(DT1, DT1, by="a"), data.table(a=1, key="a"))
8570-
8571- # Test 1601.2: Merge DT1 with DT0 on column 'a'
8572- test(1601.2, merge(DT1, DT0, by="a"),
8573- warning="Input data.table y has no columns.",
8574- error="The following columns are missing: - From y: a")
8575-
8576- # Test 1601.3: Merge DT0 with DT1 on column 'a'
8577- test(1601.3, merge(DT0, DT1, by="a"),
8578- warning="Input data.table x has no columns.",
8579- error="The following columns are missing: - From x: a")
8580-
8581- # Test 1601.4: Merge DT0 with DT0 on column 'a'
8582- test(1601.4, merge(DT0, DT0, by="a"),
8583- warning="Neither of the input data.tables to join have columns.",
8584- error="The following columns are missing: - From x: a - From y: a")
8585-
8566+ DT1 = data.table(a = 1)
8567+
8568+ test(1601.1, merge(DT1, DT1, by = "a"), data.table(a = 1, key = "a"))
8569+ test(1601.2,
8570+ merge(DT1, DT0, by = "a"),
8571+ warning = "Input data.table 'y' has no columns.",
8572+ error = "The following columns are missing:\n - From y: [a]")
8573+ test(1601.3,
8574+ merge(DT0, DT1, by = "a"),
8575+ warning = "Input data.table 'x' has no columns.",
8576+ error = "The following columns are missing:\n - From x: [a]")
8577+ test(1601.4,
8578+ merge(DT0, DT0, by = "a"),
8579+ warning = "Neither of the input data.tables to join have columns.",
8580+ error = "The following columns are missing:\n - From x: [a]\n - From y: [a]")
85868581# fix for #1549
85878582d1 <- data.table(v1=1:2,x=x)
85888583d2 <- data.table(v1=3:4)
@@ -13552,18 +13547,18 @@ test(1962.017, merge(DT1, DT2, by = 'V', by.x = 'a', by.y = 'a'),
1355213547 warning = 'Supplied both.*argument will be ignored')
1355313548test(1962.018,
1355413549 merge(DT1, DT2, by.x = 'z', by.y = 'a'),
13555- error = ' The following columns listed in by.x are missing from x: z' )
13550+ error = " The following columns listed in ' by.x' are missing from x: [z]" )
1355613551test(1962.019,
1355713552 merge(DT1, DT2, by.x = 'a', by.y = 'z'),
13558- error = ' The following columns listed in by.y are missing from y: z' )
13553+ error = " The following columns listed in ' by.y' are missing from y: [z]" )
1355913554test(1962.0201, merge(DT1, DT2, by=character(0L)), ans) # was error before PR#5183
1356013555test(1962.0202, merge(DT1, DT2, by=NULL), ans) # test explicit NULL too as missing() could be used inside merge()
1356113556test(1962.021, {
1356213557 if (!"z" %in% colnames(DT1) || !"z" %in% colnames(DT2)) {
13563- stop("The columns listed in `by` are missing from either x or y: z ")
13558+ stop("The columns listed in `by` are missing from either x or y: [z] ")
1356413559 }
1356513560 merge(DT1, DT2, by = 'z')
13566- }, error = 'The columns listed in `by` are missing from either x or y: z ')
13561+ }, error = 'The columns listed in `by` are missing from either x or y: [z] ')
1356713562
1356813563## frank.R
1356913564x = c(1, 1, 2, 5, 4, 3, 4, NA, 6)
@@ -18024,7 +18019,7 @@ test(2230.4, setDF(merge(DT, y, by="k2", incomparables=c(1, NA, 4, 5))), merge(x
1802418019test(2230.5, setDF(merge(DT, y, by="k2", incomparables=c(NA, 3, 4, 5))), merge(x, y, by="k2", incomparables=c(NA,3,4,5)))
1802518020test(2230.6, merge(DT, y, by="k2", unk=1), merge(DT, y, by="k2"), warning="Unknown argument 'unk' has been passed.")
1802618021test(2230.7, merge(DT, y, by="k2", NULL, NULL, FALSE, FALSE, FALSE, TRUE, c(".x", ".y"), TRUE, getOption("datatable.allow.cartesian"), NULL, 1L),
18027- merge(DT, y, by="k2"), warning=c("Supplied both by and by.x/by.y. by argument will be ignored.", "Passed 1 unknown and unnamed arguments."))
18022+ merge(DT, y, by="k2"), warning=c("Supplied both by and ' by.x/by.y.' by argument will be ignored.", "Passed 1 unknown and unnamed arguments."))
1802818023
1802918024# weighted.mean GForce optimized, #3977
1803018025old = options(datatable.optimize=1L)
0 commit comments