Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading (and incorrect?) error about incompatible column types in integer64 join #6625

Closed
MichaelChirico opened this issue Nov 26, 2024 · 1 comment
Labels
bit64 bug duplicate joins Use label:"non-equi joins" for rolling, overlapping, and non-equi joins

Comments

@MichaelChirico
Copy link
Member

} else stopf("Incompatible join types: %s is type integer64 but %s is type double and contains fractions", nm[2L], nm[1L])

The "and contains fractions" part really threw off a debugging effort -- typically when that comes up in my experience, it's because the "integer64" class got dropped and we wound up trying to join (integer64, unclassed-integer64-which-is-tiny-double).

Observe:

library(bit64)
i64_val = .Machine$integer.max + 1
DT1 = data.table(id = as.integer64(i64_val))
DT2 = data.table(id = i64_val)
DT1[DT2, on='id']
# Error in bmerge(i, x, leftcols, rightcols, roll, rollends, nomatch, mult,  : 
#   Incompatible join types: x.id is type integer64 but i.id is type double and contains fractions

But there's no fraction! It's just that i64_val is not integer-representable.

At a minimum we should correct the error message. But even better would be to recognize that we are perfectly capable of joining these two tables if we coerce to integer64.

(actually, it's a bit more complicated than that in general -- we need to ensure that the two values can be represented in the same class, since there are integer64 that cannot be represented in double and vice versa)

@MichaelChirico MichaelChirico added bug joins Use label:"non-equi joins" for rolling, overlapping, and non-equi joins bit64 labels Nov 26, 2024
@MichaelChirico
Copy link
Member Author

Ah, this is a duplicate of #4167. There is already some discussion there, so closing in favor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bit64 bug duplicate joins Use label:"non-equi joins" for rolling, overlapping, and non-equi joins
Projects
None yet
Development

No branches or pull requests

1 participant