-
Notifications
You must be signed in to change notification settings - Fork 185
Closed
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behaviordplyr verbs 🤖Translation of dplyr verbs to SQLTranslation of dplyr verbs to SQL
Milestone
Description
Filtering a dbplyr table with col %in% ext_vector & col == max(col) causes an error. This works in version 2.1.1, but not 2.2.0
Either of these statements by themselves, or split into seperate filter functions run correctly.
library(tidyverse)
library(dbplyr)
#> Attaching package: 'dbplyr'
#> The following objects are masked from 'package:dplyr':
#>
#> ident, sql
lf <- lazy_frame(x = 1L)
to_filter <- c('a', 'b')
lf %>% filter(x == max(x, na.rm = T))
#> <SQL>
#> SELECT `x`
#> FROM (
#> SELECT *, MAX(`x`) OVER () AS `q01`
#> FROM `df`
#> ) `q01`
#> WHERE (`x` = `q01`)
lf %>% filter(x %in% to_filter)
#> <SQL>
#> SELECT *
#> FROM `df`
#> WHERE (`x` IN ('a', 'b'))
lf %>% filter(x == max(x, na.rm = T)) %>% filter(x %in% to_filter)
#> <SQL>
#> SELECT *
#> FROM (
#> SELECT `x`
#> FROM (
#> SELECT *, MAX(`x`) OVER () AS `q01`
#> FROM `df`
#> ) `q01`
#> WHERE (`x` = `q01`)
#> ) `q02`
#> WHERE (`x` IN ('a', 'b'))
lf %>% filter(x == max(x, na.rm = T), x %in% to_filter)
#> Error in lazy_select_query(x = mutated$lazy_query, last_op = "filter", : is_lazy_sql_part(where) is not TRUECreated on 2022-11-18 with reprex v2.0.2
Metadata
Metadata
Assignees
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behaviordplyr verbs 🤖Translation of dplyr verbs to SQLTranslation of dplyr verbs to SQL