Comments (6)
@hadley commented on Jun 7, 2018, 9:38 PM UTC:
Could you please try to make a simpler example? It's not immediately obvious to me what is wrong with the incorrect output.
from dbplyr.
@sirallen commented on Jun 7, 2018, 10:50 PM UTC:
@hadley The incorrect output does not return the earliest time_hour
s (for unique destinations) by carrier. For example, it returns 2013-01-03, 2013-02-01, 2013-04-14, 2013-10-17
for carrier 9E, while the "correct" query returns times on 2013-01-01
, which are, in fact, the earliest. (I'm expecting the earliest times as I'm arranging by carrier and time_hour before the second filter
in both cases.)
Hope this clears things up (kind of difficult to create a "simpler" example that requires repeated use of window functions)
from dbplyr.
Can somebody please acknowledge that this is a problem?
from dbplyr.
I can not do anything with it until I have time to create a simpler reprex.
from dbplyr.
@sirallen - Can you try this code in your setup?
incorrect <- tbl(localdb, 'flights') %>%
group_by(carrier, dest) %>%
arrange(carrier, dest, time_hour) %>%
filter(row_number() == 1L) %>%
group_by(carrier) %>%
arrange(time_hour) %>%
filter(row_number() < 5L) %>%
select(carrier, dest, time_hour) %>%
collect()
I just removed carrier
from the second group by. I've been trying to recreate your issue, but have not been able to. I theorize that the redundant carrier
inside the order by
window function is making the database re-order the records unnecessarily. Again, just a theory, would like to see what you get.
from dbplyr.
I've looked at the generated SQL and it seems fine to me, so the most likely explanation is some minor difference in semantics between R and SQL (or between what you expect and what actually happens). If you can generate a simpler example and explain exactly what the problem is, please feel free to open a new issue.
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.