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

Hive translations for window functions were no more working #293

Merged
merged 2 commits into from
May 3, 2019

Conversation

cderv
Copy link
Contributor

@cderv cderv commented May 1, 2019

This comes from a question on community.rstudio.com

In dbplyr 1.3.0

library(dplyr)
library(dbplyr)
tab <- tbl_lazy(iris, src = simulate_hive())
query <- tab %>%
  group_by(Species) %>%
  filter(row_number() == 1L)
query %>% show_query()
<SQL> SELECT `Sepal.Length`, `Sepal.Width`, `Petal.Length`, `Petal.Width`, `Species`
FROM (SELECT `Sepal.Length`, `Sepal.Width`, `Petal.Length`, `Petal.Width`, `Species`, row_number() OVER (PARTITION BY `Species`) AS `zzz1`
FROM `df`) `ohjggmqvbj`
WHERE (`zzz1` = 1)

With 1.4.0

tab <- tbl_lazy(iris, src = simulate_hive())
query <- tab %>%
  group_by(Species) %>%
  filter(row_number() == 1L)
query %>% show_query()
<SQL>
SELECT *
FROM `df`
WHERE (row_number() = 1)

A git bisect points to this commit: f4fcfdc. This comes from a small typo - odbc window function were no more used.

This PR changes that and now it is working as before

tab <- tbl_lazy(iris, src = simulate_hive())
query <- tab %>%
  group_by(Species) %>%
  filter(row_number() == 1L)
query %>% show_query()
<SQL>
SELECT `Sepal.Length`, `Sepal.Width`, `Petal.Length`, `Petal.Width`, `Species`
FROM (SELECT `Sepal.Length`, `Sepal.Width`, `Petal.Length`, `Petal.Width`, `Species`, ROW_NUMBER() OVER (PARTITION BY `Species`) AS `zzz1`
FROM `df`) `dbplyr_001`
WHERE (`zzz1` = 1)

I can add tests later if you want. There are not so many tests for hive curently, and nothing about window function

@cderv cderv changed the title Hive translation for window function were no more working Hive translations for window functions were no more working May 1, 2019
@hadley
Copy link
Member

hadley commented May 1, 2019

A news bullet is probably enough for now.

@hadley hadley merged commit 56afe40 into tidyverse:master May 3, 2019
@hadley
Copy link
Member

hadley commented May 3, 2019

Thanks!

@cderv cderv deleted the hive-window branch May 3, 2019 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants