@@ -104,7 +104,7 @@ bmerge = function(i, x, icols, xcols, roll, rollends, nomatch, mult, ops, verbos
104104 } else stopf(" Incompatible join types: %s is type integer64 but %s is type double and contains fractions" , nm [2L ], nm [1L ])
105105 } else {
106106 # just integer and double left
107- ic_idx = which(ic == icols )
107+ ic_idx = which(ic == icols ) # check if on is joined on multiple conditions
108108 if (i_merge_type == " double" ) {
109109 coerce_x = FALSE
110110 if (! isReallyReal(i [[ic ]])) {
@@ -113,7 +113,7 @@ bmerge = function(i, x, icols, xcols, roll, rollends, nomatch, mult, ops, verbos
113113 # we've always coerced to int and returned int, for convenience.
114114 if (length(ic_idx )> 1L ) {
115115 xc_idx = xcols [ic_idx ]
116- for (xb in xcols [which(vapply_1c(x [0L , xc_idx , with = FALSE ], getClass ) == " double" )]) {
116+ for (xb in xc_idx [which(vapply_1c(x [0L , xc_idx , with = FALSE ], getClass ) == " double" )]) {
117117 if (isReallyReal(x [[xb ]])) {
118118 coerce_x = FALSE
119119 break
@@ -127,7 +127,7 @@ bmerge = function(i, x, icols, xcols, roll, rollends, nomatch, mult, ops, verbos
127127 set(callersi , j = ic , value = val ) # change the shallow copy of i up in [.data.table to reflect in the result, too.
128128 if (length(ic_idx )> 1L ) {
129129 xc_idx = xcols [ic_idx ]
130- for (xb in xcols [which(vapply_1c(x [0L , xc_idx , with = FALSE ], getClass ) == " double" )]) {
130+ for (xb in xc_idx [which(vapply_1c(x [0L , xc_idx , with = FALSE ], getClass ) == " double" )]) {
131131 if (verbose ) catf(" Coercing double column %s (which contains no fractions) to type integer to match type of %s.\n " , paste0(" x." , names(x )[xb ]), xname )
132132 set(x , j = xb , value = cast_with_atts(x [[xb ]], as.integer ))
133133 }
@@ -144,7 +144,7 @@ bmerge = function(i, x, icols, xcols, roll, rollends, nomatch, mult, ops, verbos
144144 set(i , j = ic , value = val )
145145 if (length(ic_idx )> 1L ) {
146146 xc_idx = xcols [ic_idx ]
147- for (xb in xcols [which(vapply_1c(x [0L , xc_idx , with = FALSE ], getClass ) == " integer" )]) {
147+ for (xb in xc_idx [which(vapply_1c(x [0L , xc_idx , with = FALSE ], getClass ) == " integer" )]) {
148148 if (verbose ) catf(" Coercing integer column %s to type double for join to match type of %s.\n " , paste0(" x." , names(x )[xb ]), xname )
149149 set(x , j = xb , value = cast_with_atts(x [[xb ]], as.double ))
150150 }
0 commit comments