Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

[request] support for integer64 from bit64 package #2

Closed
dselivanov opened this issue Sep 28, 2017 · 8 comments
Closed

[request] support for integer64 from bit64 package #2

dselivanov opened this issue Sep 28, 2017 · 8 comments
Assignees
Milestone

Comments

@dselivanov
Copy link

Would be great to have support for mapping of R's bit64::integer64 to monetdb BIGINT. (I believe this is quite simple since bit64::integer64 is just long long and I'm pretty sure same as BIGINT)

I can't find a solution how to keep integer64. Is there any workaround?

@hannes hannes self-assigned this Sep 28, 2017
@hannes
Copy link
Contributor

hannes commented Sep 28, 2017

We will add this at some point. The workaround now is a CAST to string before the result column is handed over.

@hannes
Copy link
Contributor

hannes commented Sep 28, 2017

Want to give it a try? I'd be happy to review a PR.

@hannes hannes added this to the 0.5.0 milestone Sep 28, 2017
@dselivanov
Copy link
Author

Can'r promise, but mb will try to create PR this weekend.

@hannes hannes modified the milestones: 0.5.0, 0.6.0 Nov 6, 2017
@hannes
Copy link
Contributor

hannes commented Jun 21, 2018

Okay, I did this in the end, this should work (with the master branch)

library(bit64)
library(DBI)
con <- dbConnect(MonetDBLite::MonetDBLite())

options(monetdb.int64=T)

a <- data.frame(a=as.integer64(c(42, NA, 4294967294)))

dbWriteTable(con, "a", a)
print(res <- dbGetQuery(con, "SELECT * from a"))
print(str(res))

The monetdb.int64 option enables the writing of bit64 integer64 vectors as BIGINT and the conversion of results of BIGINT to integer64 R vectors. Is this what you expected?

@hannes
Copy link
Contributor

hannes commented Jun 21, 2018

Referencing a DBI issue on the topic here: r-dbi/DBI#248

@hannes hannes closed this as completed Jun 21, 2018
@dselivanov
Copy link
Author

Awesome! I will test and report back.

@dselivanov
Copy link
Author

@hannesmuehleisen works perfectly. Many thanks!

@hannes
Copy link
Contributor

hannes commented Jul 2, 2018

Extended to support dbConnect parameter bigint as standardized by DBI:

library(bit64)
library(DBI)
con <- dbConnect(MonetDBLite::MonetDBLite(), bigint="integer64")
a <- data.frame(a=as.integer64(c(42, NA, 4294967294)))
dbWriteTable(con, "a", a)
print(res <- dbGetQuery(con, "SELECT * from a"))
print(str(res))

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants