I am getting some interesting errors in the last CRAN version (1.1) of RSQLite. The error is not 100% reproducible, i.e. sometimes there is no error, sometimes the warning message appears (slightly changed). It seems that the error is more likely to appear when the data stored in blob is large.
I was able to create a (sometimes) reproducible example.
#library(DBI)
#library(RSQLite)
#library(ggplot2)
#library(ggplot2movies)
# the error occurs for both memory and file connections.
conn <- DBI::dbConnect(RSQLite::SQLite(), ':memory:')
statement <-
"CREATE TABLE _cache(
hash_key TEXT NOT NULL,
data_blob BLOB NOT NULL,
PRIMARY KEY (hash_key))"
res1 <- DBI::dbExecute(conn, statement)
# a large list, to be cached
big_data_obj <- list(
a = ggplot2::diamonds,
b = ggplot2::txhousing,
c = ggplot2::faithfuld,
d = rep(ggplot2movies::movies, 10)
)
# one row df containing the large list
df <- data.frame(
hash_key = 'hash1',
data_blob = I(list(serialize(big_data_obj, NULL))),
stringsAsFactors = FALSE
)
statement <- "INSERT INTO _cache VALUES (:hash_key, :data_blob)"
res2 <- DBI::dbExecute(conn, statement, param = df)
statement <- "SELECT * FROM _cache"
res3 <- DBI::dbGetQuery(conn, statement) # <- this is where the error occurs
# code to extract the list from res3 not included
DBI::dbDisconnect(conn)
I get the following warnings and res3 is NULL.
> source('RSQLite_test/test1.R')
Warning messages:
1: In value[[3L]](cond) :
SET_VECTOR_ELT() can only be applied to a 'list', not a 'character'
2: Pending rows
> source('RSQLite_test/test1.R')
Warning messages:
1: In value[[3L]](cond) :
SET_VECTOR_ELT() can only be applied to a 'list', not a 'raw'
2: Pending rows
> source('RSQLite_test/test1.R')
Warning messages:
1: In value[[3L]](cond) :
SET_VECTOR_ELT() can only be applied to a 'list', not a 'NULL'
2: Pending rows
> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] colorspace_1.3-1 scales_0.4.1 assertthat_0.1 lazyeval_0.2.0 plyr_1.8.4
[6] DBI_0.5-1 tools_3.3.2 gtable_0.2.0 tibble_1.2 memoise_1.0.0.9001
[11] Rcpp_0.12.8 ggplot2_2.2.0 ggplot2movies_0.0.1 RSQLite_1.1 grid_3.3.2
[16] digest_0.6.10 munsell_0.4.3
Any suggestions will be appreciated.
I am getting some interesting errors in the last CRAN version (1.1) of RSQLite. The error is not 100% reproducible, i.e. sometimes there is no error, sometimes the warning message appears (slightly changed). It seems that the error is more likely to appear when the data stored in blob is large.
I was able to create a (sometimes) reproducible example.
I get the following warnings and
res3isNULL.Any suggestions will be appreciated.