hannes / MonetDBLite

MonetDB reconfigured as a library
108 stars 10 forks source link

MonetDBConnection PLAN causes error and EXPLAIN causes crash #149

Closed ajdamico closed 7 years ago

ajdamico commented 7 years ago

hi, here's a minimal reproducible example using the latest of both mserver and monetdblite branches. includes comparable code to show that PLAN and EXPLAIN syntax both work fine on an embedded connection.. happens on rocks109. thanks

# http://monetdb.cwi.nl/testweb/web/63930:16a4efa7b3dc/MonetDB5-SQL-Installer-x86_64-16a4efa7b3dc.msi
# devtools::install_github( "hannesmuehleisen/MonetDBLite" , ref = "Jul2017Lite-R" )

library(DBI)
library(MonetDBLite)
batfile <- 
    monetdb.server.setup( 
        file.path( tempdir() , "mserver" ) , 
        monetdb.program.path = 
                        ifelse( 
                            .Platform$OS.type == "windows" , 
                            "C:/Program Files/MonetDB/MonetDB5" , 
                            "" 
                        ) 
    )

pid <- monetdb.server.start(batfile)
db_mserver <- dbConnect( MonetDBLite::MonetDB.R() , wait = TRUE )
db_lite <- dbConnect( MonetDBLite::MonetDBLite() , file.path( tempdir() , "lite" ) )

dbWriteTable( db_mserver , 'mtcars' , mtcars )
dbWriteTable( db_lite , 'mtcars' , mtcars )

this_query <- "SELECT * FROM mtcars"

# works
lite_query_explain <- dbGetQuery( db_lite , paste( "EXPLAIN" , this_query ) )
writeLines( lite_query_explain[ , 1 ] , file.path( path.expand( "~" ) , "lite_query_explain.txt" ) )

# works
lite_query_plan <- dbGetQuery( db_lite , paste( "PLAN" , this_query ) )
writeLines( lite_query_plan[ , 1 ] , file.path( path.expand( "~" ) , "lite_query_plan.txt" ) )

# ERROR
mserver_query_plan <- dbGetQuery( db_mserver , paste( "PLAN" , this_query ) )
# Error in dbFetch(rs, n = -1, ...) : 
# VECTOR_ELT() can only be applied to a 'list', not a 'integer'

# CRASH
mserver_query_explain <- dbGetQuery( db_mserver , paste( "EXPLAIN" , this_query ) )
hannes commented 7 years ago

https://github.com/hannesmuehleisen/MonetDBLite/commit/8ecb5ed7402de3fb43b17e9336e71a679122fe50