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

Integer64 columns not assigned NA when doing a left merge #1459

Closed
2 tasks done
abielr opened this issue Dec 4, 2015 · 5 comments · Fixed by #3724
Closed
2 tasks done

Integer64 columns not assigned NA when doing a left merge #1459

abielr opened this issue Dec 4, 2015 · 5 comments · Fixed by #3724
Assignees
Milestone

Comments

@abielr
Copy link

abielr commented Dec 4, 2015

Handle NA integer64 properly in:

  • merge
  • rbindlist (following @jangorecki's comment below)
require(data.table)
require(bit64)
x1 <- data.table(id=1, value=as.integer64(1))
x2 <- data.table(id=c(1,2))
merge(x2, x1, by="id", all.x=T)

Yields

#    id               value
#1:  1                   1
#2:  2 9218868437227407266

This is with data.table 1.9.6.

@dlithio
Copy link

dlithio commented Dec 4, 2015

I think this is a duplicate.

@arunsrinivasan
Copy link
Member

Thanks for linking to the old issue @dlithio. Maybe we can fix it internally..

@jangorecki
Copy link
Member

jangorecki commented Apr 23, 2016

The same happens when rbindlist(fill=TRUE). This probably can be fixed in the same place as merge so I'm not creating new issue for that, let me know if you want separate one for rbindlist fill.

library(data.table)
library(bit64)
rbindlist(list(
    data.table(a=1:2, b=as.integer64(c(1,NA))),
    data.table(a=3L)
), fill=TRUE)
#   a                   b
#1: 1                   1
#2: 2                  NA
#3: 3 9218868437227407266

@arunsrinivasan arunsrinivasan added this to the v1.9.8 milestone Jul 21, 2016
@arunsrinivasan arunsrinivasan self-assigned this Jul 21, 2016
@arunsrinivasan arunsrinivasan modified the milestones: v2.0.0, v1.9.8 Jul 25, 2016
@andrewkho
Copy link

andrewkho commented Oct 2, 2017

I'm not sure if I should create a new issue for this, but I am having this problem when using the := operator, but not when using merge.

> packageVersion("data.table")
[1] ‘1.10.4’
> packageVersion("bit64")
[1] ‘0.9.7’
> dt1 <- data.table(id=c(1,2), x=bit64::as.integer64(c(100,200)))
> dt2 <- data.table(id=c(1,3))
> dt1
   id   x
1:  1 100
2:  2 200
> dt2
   id
1:  1
2:  3
> merge(dt1,dt2, all=T)
   id   x
1:  1 100
2:  2 200
3:  3  NA
> dt2[J(dt1), x := i.x, on=.(id)]
> dt2
   id                   x
1:  1                 100
2:  3 9218868437227407266

Update: I guess this is the expected behaviour:

> merge(dt1, dt2, all.y = T)
   id   x
1:  1 100
2:  3  NA

I have a lot of code using the := method, and I'm not sure if it's feasible to switch everything to use merge instead

@MichaelChirico
Copy link
Member

MichaelChirico commented Oct 3, 2017 via email

@mattdowle mattdowle removed this from the Candidate milestone May 10, 2018
@mattdowle mattdowle added this to the 1.12.4 milestone Aug 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants