-
Notifications
You must be signed in to change notification settings - Fork 47
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
Data Type Conversion Option for RJDBC #8
Conversation
Thanks, this is a good idea. There are a few minor things (e.g., you don't want to use |
moved into |
Great :) Do you think the default conversion should be Is there anything else you think should be altered? |
Can I ask about the status of this pull request? This looks like it will allow us to bring BIGINT over as character, (and then later apply bit64 int64 type). If so, we could really use this. Do you need help with testing? |
I'd forgotten about this work! Based on Simon's comments, I've made some additional changes to fix the date conversion ( With the changes in this branch you should be able to achieve the conversions you described by setting up a higher priority type-conversion via the options - i.e. something like: type.map = c('bigint'=c(types$BIGINT), default.type.map)
conversion.map = c('bigint'=bit64::as.integer64, default.conversion.map)
RJDBC.options(convert.types=TRUE, type.map=type.map, conversion.map=conversion.map) |
This code is very interesting for an issue I have with 64bit integers. However, I was wondering why over 2 years after the pull-request, it hasn't been merged. Is there some conflict anyone is aware of? |
Not to my knowledge - I'd completely forgotten about this work again. |
Any news on this update. I'm really looking for this feature. |
Hi Josh, thank you very much. This is very helpful. I'm out for the week.
As soon I'm back, I'll use your version.
Thanks
Max
…On Fri, Jun 23, 2017, 11:04 PM Josh Bode ***@***.***> wrote:
Hi @maxmoro <https://github.com/maxmoro> - I'm not using R much any more,
so I had let this sit.
I haven't heard back from @s-u <https://github.com/s-u> on this, but I've
just brought the fork/PR up to date with master.
If you wanted to test/use it, let me know and I'll see how you could use
it (probably using devtools install_github("joshbode/RJDBC") directly off
my fork works)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8 (comment)>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AIMgVnRnCC3r5fwP26aFGYF87cym_d1wks5sHKcGgaJpZM4B508Y>
.
|
Thinking about it, there's a build step in there ( So, you may be better doing something like cloning the repo, running If you have any issues (e.g. missing JDK, etc) let me know and I help or just compile it for you. |
07e92da
to
cc976a7
Compare
OK - by adding require(devtools)
install_github("joshbode/RJDBC") assuming you are on Linux/macOS (or possibly Rtools if on Windows), and have |
Data type conversions for specialised numeric (integer and boolean) and non-character data types such as dates. Uses Java SQL data type codes to map data rather than hard-coded flags.
Hi @s-u - do you have any plans to merge this? Is there anything else you would like to see here? Apart from the type conversions work, this also streamlines the build of the library so it works directly with
If not, I'll close the PR. |
Closing - after all this time, I'm not using this package any more - if anyone wants to pick up this PR, feel free to fork my branch :) |
Thanks, I have added a slightly different implementation in 1c6399c with similar goals. The main difference is that I have opted for single-point entry where the fetching form Java stays as-is and only the post-processing is done in R on per-column basis. |
Hi Simon,
I've added some code to a fork of RJDBC enabling the conversion of data returned from queries to specific R data-types, based on the Java SQL data type constants (see [http://docs.oracle.com/javase/7/docs/api/constant-values.html#java.sql]).
Not sure if this is something you want to incorporate, but my motivation for this is that I work with a lot of time-series data and just about every one of my queries has an
as.POSIXlt
oras.Date
immediately following it. I much prefer RJDBC over other options for two reasons - 1) It's much more portable (I work on a Windows machine where I don't have admin access :( ), and 2) I've found some of the implicit type conversion in RODBC to be too enthusiastic at times (e.g. a string column containing only numbers converted tonumeric
that I'd rather keep ascharacter
).To reduce impact on existing users, I've made it the default to perform no conversions, as per the existing code.
Happy to discuss and make changes if this is of any use.