diff --git a/R/bmerge.R b/R/bmerge.R index 571a18ec7..b6e0f4afb 100644 --- a/R/bmerge.R +++ b/R/bmerge.R @@ -88,7 +88,7 @@ bmerge = function(i, x, icols, xcols, roll, rollends, nomatch, mult, ops, verbos set(i, j=ic, value=match.fun(paste0("as.", x_merge_type))(i[[ic]])) next } - else if (anyNA(x[[xc]]) && allNA(x[[xc]])) { + if (anyNA(x[[xc]]) && allNA(x[[xc]])) { if (verbose) catf("Coercing all-NA %s (%s) to type %s to match type of %s.\n", xname, x_merge_type, i_merge_type, iname) set(x, j=xc, value=match.fun(paste0("as.", i_merge_type))(x[[xc]])) next @@ -115,7 +115,7 @@ bmerge = function(i, x, icols, xcols, roll, rollends, nomatch, mult, ops, verbos xc_idx = xcols[ic_idx] for (b in which(vapply_1c(x[0L, ..xc_idx], getClass) == "double")) { xb = xcols[b] - if (!isReallyReal(x[[xb]])) { + if (isReallyReal(x[[xb]])) { coerce_x = FALSE break } diff --git a/inst/tests/tests.Rraw b/inst/tests/tests.Rraw index 71c43aa67..f77c3fbcb 100644 --- a/inst/tests/tests.Rraw +++ b/inst/tests/tests.Rraw @@ -20611,9 +20611,9 @@ test(2297.03, options=c(datatable.verbose=TRUE), y[x, on=.(c == a, d == a)], dat test(2297.04, options=c(datatable.verbose=TRUE), y[x, on=.(d == a, c == a)], data.table(c=d_int, d=d_int), output="Coercing .*c to type double") x = data.table(a=1) y = data.table(c=1, d=1L) -test(2297.11, options=c(datatable.verbose=TRUE), y[x, on=.(c == a, d == a)], data.table(c=1, d=1), output="Coercing .*d to type double") -test(2297.12, options=c(datatable.verbose=TRUE), y[x, on=.(d == a, c == a)], data.table(c=1, d=1), output="Coercing .*d to type double") +test(2297.11, options=c(datatable.verbose=TRUE), y[x, on=.(c == a, d == a)], data.table(c=1L, d=1L), output="Coercing double column x.c (which contains no fractions) to type integer") +test(2297.12, options=c(datatable.verbose=TRUE), y[x, on=.(d == a, c == a)], data.table(c=1L, d=1L), output="Coercing double column x.c (which contains no fractions) to type integer") x = data.table(a=d_dbl) y = data.table(c=d_dbl, d=d_int) -test(2297.13, options=c(datatable.verbose=TRUE), y[x, on=.(c == a, d == a)], data.table(c=d_dbl, d=d_dbl), output="Coercing .*d to type double") -test(2297.14, options=c(datatable.verbose=TRUE), y[x, on=.(d == a, c == a)], data.table(c=d_dbl, d=d_dbl), output="Coercing .*d to type double") +test(2297.13, options=c(datatable.verbose=TRUE), y[x, on=.(c == a, d == a)], data.table(c=d_int, d=d_int), output="Coercing double column x.c (which contains no fractions) to type integer") +test(2297.14, options=c(datatable.verbose=TRUE), y[x, on=.(d == a, c == a)], data.table(c=d_int, d=d_int), output="Coercing double column x.c (which contains no fractions) to type integer")