# here's a reproducible example using R code to repeat the sampling 1000
times. in both SAMPLE examples below, the database pulls the 2 less than
200 times out of 1000. shouldn't it be close to 500 out of 1000? this
seems not random (misleading to users?) sorry if i'm misunderstanding
something.. thank you!!
# start in an empty directory somewhere
# setwd( "C:/My Directory/MonetDB" )
# # # # # # # # # START OF SETUP - no editing required
library(MonetDB.R)
batfile <-
monetdb.server.setup(
database.directory = paste0( getwd() , "/MonetDB" ) ,
monetdb.program.path =
ifelse(
.Platform$OS.type == "windows" ,
"C:/Program Files/MonetDB/MonetDB5" ,
""
) ,
dbname = "test" ,
dbport = 50000
)
pid <- monetdb.server.start( batfile )
db <- dbConnect( MonetDB.R() , "monetdb://localhost:50000/test" , wait =
TRUE )
# # # END OF SETUP
dbGetQuery( db , "SELECT 1 AS col UNION ALL SELECT 2 AS col" )
out <- NULL
for ( i in 1:1000 ){
out <- c( out , dbGetQuery( db , "SELECT * FROM ( SELECT 1 AS col UNION ALL
SELECT 2 AS col ) AS temp SAMPLE 0.5" ) )
}
# not random
table( unlist( out ) )
# 1 2
# 880 120
out <- NULL
for ( i in 1:1000 ){
out <- c( out , dbGetQuery( db , "SELECT * FROM ( SELECT 1 AS col UNION
ALL SELECT 2 AS col ) AS temp SAMPLE 1" ) )
}
# ALSO not random
table( unlist( out ) )
# 1 2
# 856 144