Skip to content

Commit ec65db7

Browse files
fix botched merge
1 parent dfdcd9b commit ec65db7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

R/bmerge.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ bmerge = function(i, x, icols, xcols, roll, rollends, nomatch, mult, ops, verbos
103103
if (x_merge_type=="integer64" || i_merge_type=="integer64") {
104104
nm = c(iname, xname)
105105
if (x_merge_type=="integer64") { w=i; wc=icol; wclass=i_merge_type; } else { w=x; wc=xcol; wclass=x_merge_type; nm=rev(nm) } # w is which to coerce
106-
if (wclass=="integer" || (wclass=="double" && !isRealReallyInt64(w[[wc]]))) {
106+
if (wclass=="integer" || (wclass=="double" && isRealReallyInt64(w[[wc]]))) {
107107
if (verbose) catf("Coercing %s column %s%s to type integer64 to match type of %s.\n", wclass, nm[1L], if (wclass=="double") " (which has integer64 representation, e.g. no fractions)" else "", nm[2L])
108108
set(w, j=wc, value=bit64::as.integer64(w[[wc]]))
109109
} else stopf("Incompatible join types: %s is type integer64 but %s is type double and cannot be coerced to integer64 (e.g. has fractions)", nm[2L], nm[1L])
@@ -112,14 +112,14 @@ bmerge = function(i, x, icols, xcols, roll, rollends, nomatch, mult, ops, verbos
112112
ic_idx = which(icol == icols) # check if on is joined on multiple conditions, #6602
113113
if (i_merge_type=="double") {
114114
coerce_x = FALSE
115-
if (!isRealReallyInt32(i[[icol]])) {
115+
if (isRealReallyInt32(i[[icol]])) {
116116
coerce_x = TRUE
117117
# common case of ad hoc user-typed integers missing L postfix joining to correct integer keys
118118
# we've always coerced to int and returned int, for convenience.
119119
if (length(ic_idx)>1L) {
120120
xc_idx = xcols[ic_idx]
121121
for (xb in xc_idx[which(vapply_1c(.shallow(x, xc_idx), mergeType) == "double")]) {
122-
if (isRealReallyInt32(x[[xb]])) {
122+
if (!isRealReallyInt32(x[[xb]])) {
123123
coerce_x = FALSE
124124
break
125125
}

0 commit comments

Comments
 (0)