s-u / RJDBC

R interface to databases using JDBC
Other
52 stars 47 forks source link

Attempt to use with Apache Ignite v2.1 #49

Closed pranasblk closed 3 years ago

pranasblk commented 7 years ago

The Java / DBeaver client works Apache Ignite, but can attempt:

if (!require("RJDBC")) {
  install.packages("RJDBC",repos="http://cran.rstudio.com/")
  library("RJDBC")
}

jdbcDriver <- JDBC("org.apache.ignite.IgniteJdbcThinDriver",
            "/Users/pranas/Apps/apache-ignite-fabric-2.1.0-bin/libs/ignite-core-2.1.0.jar:/Users/pranas/Apps/apache-ignite-fabric-2.1.0-bin/libs/log4j-1.2.17.jar")

conn <- dbConnect(jdbcDriver, "jdbc:ignite:thin://localhost")
dbGetQuery(conn, "SELECT * FROM OHLC Oder WHERE SECURITYID = 100")
dbDisconnect(conn)

Causes:

> dbGetQuery(conn, "SELECT * FROM OHLC Oder WHERE SECURITYID = 100")
Error in .jcall(rp, "I", "fetch", stride, block) : 
  java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Double
> dbDisconnect(conn)
[1] TRUE

Some ideas?

shanglai commented 6 years ago

I have the same issue with Integer and Long type columns. I've triple-checked and I uploaded the data correctly, and use other frameworks (ie. Spark, but with sharedRDDs not JDBC connection) without an issue and the types are ok.

s-u commented 3 years ago

Please supply the exact schema definition and dbColumnInfo() output. This appears to be an issue in the driver you're using where it is unable to retrieve numeric type as Double which is how R stores numeric types. Please re-open with details against latest RJDBC if this is still an issue.