Skip to content

Commit 4ff68a5

Browse files
.prepareFastSubset fix
1 parent d9a88cd commit 4ff68a5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

R/data.table.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3240,9 +3240,9 @@ is_constantish = function(q, check_singleton=FALSE) {
32403240
if (length(RHS) != nrow(x)) stopf("RHS of %s is length %d which is not 1 or nrow (%d). For robustness, no recycling is allowed (other than of length 1 RHS). Consider %%in%% instead.", operator, length(RHS), nrow(x))
32413241
return(NULL) # DT[colA == colB] regular element-wise vector scan
32423242
}
3243-
if ( mode(x[[col]]) != mode(RHS) || # mode() so that doubleLHS/integerRHS and integerLHS/doubleRHS&isRealReallyInt32 are optimized (both sides mode 'numeric')
3244-
is.factor(x[[col]])+is.factor(RHS) == 1L || # but factor is also mode 'numeric' so treat that separately
3245-
is.integer(x[[col]]) && (!is.double(RHS) || !isRealReallyInt32(RHS)) ) { # and if RHS contains fractions then don't optimize that as bmerge truncates the fractions to match to the target integer type
3243+
if ( (mode(x[[col]]) != mode(RHS)) || # mode() so that doubleLHS/integerRHS and integerLHS/doubleRHS&isRealReallyInt32 are optimized (both sides mode 'numeric')
3244+
(is.factor(x[[col]])+is.factor(RHS) == 1L) || # but factor is also mode 'numeric' so treat that separately
3245+
(is.integer(x[[col]]) && is.double(RHS) && !isRealReallyInt32(RHS)) ) { # and if RHS contains fractions then don't optimize that as bmerge truncates the fractions to match to the target integer type
32463246
# re-direct non-matching type cases to base R, as data.table's binary
32473247
# search based join is strict in types. #957, #961 and #1361
32483248
# the mode() checks also deals with NULL since mode(NULL)=="NULL" and causes this return, as one CRAN package (eplusr 0.9.1) relies on

0 commit comments

Comments
 (0)