Comments (3)
Looking into it I gathered that what happens is that the error is triggered because partial_eval
eventually calls lang_partial_eval
which calls bare_eval
because of the $
in the expression.
As far as I can tell the .data
pronoun never gets installed before that so it tries to get .data$column
from the empty .data
pronoun that rlang
creates globally, hence the message.
There's a workaround (creating a data pronoun manually) that seems to work for most dplyr verbs, but fails with select
and distinct
:
var_strs <- dbplyr::op_vars(mtcars2)
x <- syms( var_strs )
names( x ) <- var_strs
my_pronoun <- rlang::as_data_pronoun( x )
# Now this works, as do most other dplyr verbs
mutate( mtcars2, foo = my_pronoun$cyl )
# But these fail:
select( mtcars2, my_pronoun$cyl )
# Error: `my_pronoun$cyl` must evaluate to column positions or names, not a symbol
distinct( mtcars2, my_pronoun$cyl )
# Error in result_create(conn@ptr, statement) : no such column: my_pronoun$cyl
select
fails here because, unlike the other verbs, it never calls partial_eval
, and the error message is coming from tidyselect::vars_select()
.
distinct
apparently uses the names and not the values of the object that partial_eval
returns. It also means that
distinct( mtcars2, cyl = anything )
functions identically to distinct( mtcars2, cyl )
, which is not consistent with how the dataframe version works.
from dbplyr.
Minimal reprex:
library(dplyr, warn.conflicts = FALSE)
mf <- dbplyr::memdb_frame(a = 1, b = 2)
mutate(mf, foo = .data$a)
#> Error in if (length(ans) == 0L || as.character(ans[[1L]])[1L] == "~") {: missing value where TRUE/FALSE needed
Created on 2019-01-02 by the reprex package (v0.2.1)
This probably requires special treatment of the $
translation when the LHS is .data
or .env
from dbplyr.
And hence this is part of #200
from dbplyr.
Related Issues (20)
- Incorrect translation of dates with Oracle ODBC. HOT 1
- Pre-release revdeps HOT 2
- Helper to get `last_sql()`
- str_detect() and str_replace() not treating period (.) detection same in snowflake translation HOT 3
- `paste0()` incorrectly uses a `sep` argument
- Snowflake translation error: dropped filter with `anti_join` HOT 3
- Filter by a column in another table HOT 5
- Release dbplyr 2.5.0
- rstudio autocomplete slows down from 2.3.4 -> 2.4.0
- Breaking changes in dbplyr 2.5.0 HOT 9
- `distinct()` in Databricks/SparkSQL causes "arrange()... __row_num_*" error
- `head()` modifies `SELECT *`
- Export `check_na_rm()`
- rows_upsert worked in 2.4.0, broke with 2.5.0 HOT 2
- `sql` in `in_catalog` breaks with `filter` HOT 1
- Regression in window_order variable argument parsing for 2.5.0
- Unable to use quantile() in mutate() in DuckDB HOT 4
- Possible inconsistency in translation of stringr::str_like() with respect to ignore_case argument HOT 2
- postition of head in pipeline no longer leading to different sql HOT 3
- rows_delete fails due to key constraints: Canβt Modify Database Table
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dbplyr.