You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (xclass=="integer64") { w=i; wc=ic; wclass=iclass; } else { w=x; wc=xc; wclass=xclass; nm=rev(nm) } # w is which to coerce
95
-
if (wclass=="integer"|| (wclass=="double"&&!isReallyReal(w[[wc]], vs='i64'))) {
95
+
if (wclass=="integer"|| (wclass=="double"&&!isRealReallyInt64(w[[wc]]))) {
96
96
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])
97
97
set(w, j=wc, value=bit64::as.integer64(w[[wc]]))
98
98
} 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])
99
99
} else {
100
100
# just integer and double left
101
101
if (iclass=="double") {
102
-
if (!isReallyReal(i[[ic]])) {
102
+
if (!isRealReallyInt32(i[[ic]])) {
103
103
# common case of ad hoc user-typed integers missing L postfix joining to correct integer keys
104
104
# we've always coerced to int and returned int, for convenience.
105
105
if (verbose) catf("Coercing double column %s (which contains no fractions) to type integer to match type of %s.\n", iname, xname)
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))
if ( mode(x[[col]]) != mode(RHS) ||# mode() so that doubleLHS/integerRHS and integerLHS/doubleRHS!isReallyReal are optimized (both sides mode 'numeric')
3243
+
if ( mode(x[[col]]) != mode(RHS) ||# mode() so that doubleLHS/integerRHS and integerLHS/doubleRHS!isRealReallyInt32 are optimized (both sides mode 'numeric')
3244
3244
is.factor(x[[col]])+is.factor(RHS) ==1L||# but factor is also mode 'numeric' so treat that separately
3245
-
is.integer(x[[col]]) &&isReallyReal(RHS) ) { # and if RHS contains fractions then don't optimize that as bmerge truncates the fractions to match to the target integer type
3245
+
is.integer(x[[col]]) &&isRealReallyInt32(RHS) ) { # and if RHS contains fractions then don't optimize that as bmerge truncates the fractions to match to the target integer type
3246
3246
# re-direct non-matching type cases to base R, as data.table's binary
3247
3247
# search based join is strict in types. #957, #961 and #1361
3248
3248
# 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
if (verbose&&INHERITS(x, char_Date) &&INTEGER(isReallyReal(x))[0]==0) {
599
-
Rprintf(_("\n*** Column %d passed to forder is a date stored as an 8 byte double but no fractions are present. Please consider a 4 byte integer date such as IDate to save space and time.\n"), col+1);
600
-
// Note the (slightly expensive) isReallyReal will only run when verbose is true. Prefix '***' just to make it stand out in verbose output
598
+
if (verbose&&INHERITS(x, char_Date) &&isRealReallyInt32(x)) {
599
+
// Note the (slightly expensive) isRealReallyInt32 will only run when verbose is true. Prefix '***' just to make it stand out in verbose output
601
600
// In future this could be upgraded to option warning. But I figured that's what we use verbose to do (to trace problems and look for efficiencies).
602
601
// If an automatic coerce is desired (see discussion in #1738) then this is the point to do that in this file. Move the INTSXP case above to be
603
602
// next, do the coerce of Date to integer now to a tmp, and then let this case fall through to INTSXP in the same way as CPLXSXP falls through to REALSXP.
603
+
Rprintf(_("\n*** Column %d passed to forder is a date stored as an 8 byte double but no fractions are present. Please consider a 4 byte integer date such as IDate to save space and time.\n"), col+1);
0 commit comments