You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expectation: Copy&Paste of the explain output into the SQL CLI should yield the same result as executing the query.
But here the output of explain depends on options(digits.secs). Is that correct?
rm(list=ls())
library(RSQLite)
library(dplyr)
library(dbplyr)
# Create example table in-memorycon<- dbConnect(RSQLite::SQLite(), ":memory:", extended_types=TRUE)
con %>% dbExecute("CREATE TABLE tmp (t datetime );")
time1<-"2024-01-11 09:17:12.345" %>% as.POSIXct()
df<-data.frame(t=time1)
con %>% dbAppendTable("tmp",df)
# Query with a datetime filter - digits.secs is 0, result is not affectedtime2<-"2024-01-11 09:17:12.678" %>% as.POSIXct()
options(digits.secs=0)
con %>% tbl("tmp") %>% filter(t<=time2) %>% explain()
con %>% tbl("tmp") %>% filter(t<=time2) %>% collect()
# Query with a datetime filter - digits.secs is 3
options(digits.secs=3)
con %>% tbl("tmp") %>% filter(t<=time2) %>% explain()
con %>% tbl("tmp") %>% filter(t<=time2) %>% collect()
Output:
<SQL>
SELECT *
FROM `tmp`
WHERE (`t` <= '2024-01-11T08:17:12Z')
<PLAN>
id parent notused detail
1 2 0 0 SCAN tmp
<SQL>
SELECT *
FROM `tmp`
WHERE (`t` <= '2024-01-11T08:17:12.677Z')
<PLAN>
id parent notused detail
1 2 0 0 SCAN tmp
The text was updated successfully, but these errors were encountered:
So it seems probably fine to me? I don't love that a global option affects this, but that option is baked fairly deeply in to R itself, and if that option didn't exist, we'd have to find some other way to pass the number of digits.
Expectation: Copy&Paste of the explain output into the SQL CLI should yield the same result as executing the query.
But here the output of explain depends on options(digits.secs). Is that correct?
Output:
The text was updated successfully, but these errors were encountered: