Skip to content
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

Bug when using R*tree module #61

Closed
thomasp85 opened this issue Nov 13, 2014 · 6 comments
Closed

Bug when using R*tree module #61

thomasp85 opened this issue Nov 13, 2014 · 6 comments

Comments

@thomasp85
Copy link

I have an open question on StackOverflow (http://stackoverflow.com/questions/26816880/debugging-sqlite-rtree), where a commenter indicated that my problem was related to an RSQLite bug. The SO question comes with a minimal example, but in essence:

When creating an R*tree the comparator querying gets broken. Asking for all records where a value is above a certain level would yield no results, even though there is lots of records with higher values (again it is all described more thoroughly in the SO question).

Is it possible to examine whether it is indeed a bug in RSQLite that causes this behaviour?

@thomasp85
Copy link
Author

It has been confirmed that the bug does not appear in the most recent version of SQLite (3.8.7.1), but this is outside the RSQLite framework, so it is still open whether it is a bug in the RSQLite framework or in SQLite 3.8.6 (the release history does not mention a bug fix that appears as this one)

@thomasp85
Copy link
Author

The bug is specific to RSQLite on mac (both mavericks and snow leopard build). It cannot be replicated in other SQLite clients on Mac so it seems to be specific to the RSQLite client

@hadley
Copy link
Member

hadley commented Nov 14, 2014

Moving in your reproducible example from SO and simplifying it a bit:

library(RSQLite)
con <- dbConnect(RSQLite::SQLite(), ':memory:')
dbGetQuery(con, 'CREATE VIRTUAL TABLE test USING rtree(id, xmin, xmax, ymin, ymax)')
set.seed(1)
x <- abs(rnorm(100))
y <- abs(rnorm(100))
data <- data.frame(id=1:100, xmin=x, xmax=x+2, ymin=y, ymax=y+3)
dbWriteTable(con, "test", data, append = TRUE)

dbGetQuery(con, 'SELECT max(xmax) FROM test')
dbGetQuery(con, 'SELECT * FROM test WHERE xmax > 4')
subset(data, xmax > 4)

The query and the R command return the same results for me.

@thomasp85
Copy link
Author

Ok so this is strange. Even though the bug was reproducible across several days on several R sessions it has suddenly vanished - both on the original and your modified example. I cannot give any explanation for this as there has been no changes to my system... I still have a database file with the example results from back when the bug existed - don't know whether that can shed any light on what might have happened?

@hadley
Copy link
Member

hadley commented Jan 31, 2015

No idea, sorry.

@hadley hadley closed this as completed Jan 31, 2015
troels pushed a commit to troels/RSQLite that referenced this issue Nov 27, 2019
troels pushed a commit to troels/RSQLite that referenced this issue Nov 27, 2019
- Improve DBI compatibility (r-dbi#24, r-dbi#41, r-dbi#52, r-dbi#53, r-dbi#61, r-dbi#62, r-dbi#70, r-dbi#79, r-dbi#104, r-dbi#121).
- Define `timegm` for Windows and add missing function (r-dbi#136).
- The time zone is set by executing `SET TIMEZONE='UTC'` instead of setting an environment variable (r-dbi#136).
@github-actions
Copy link

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants