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

Fix add_years translation on spark #1511

Merged
merged 2 commits into from
Oct 31, 2024
Merged

Conversation

ablack3
Copy link
Contributor

@ablack3 ablack3 commented Jun 5, 2024

Addresses issue #1510

Copy link
Collaborator

@simonpcouch simonpcouch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Confirming that it indeed works using the reprex from the issue:

library(odbc)
library(clock)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union

con <- dbConnect(databricks(), HTTPPath = "/sql/1.0/warehouses/300bd24ba12adf8e")

df <- data.frame(x = as.POSIXct("2000-01-01"))
copy_to(con, df)

q <- tbl(con, "df") %>% mutate(y = add_years(x, 1))

q %>% show_query()
#> <SQL>
#> SELECT `df`.*, ADD_MONTHS(`x`, 1.0 * 12.0) AS `y`
#> FROM `df`

q %>% collect()
#> # A tibble: 1 × 2
#>   x                   y         
#>   <dttm>              <date>    
#> 1 2000-01-01 06:00:00 2001-01-01

Created on 2024-08-27 with reprex v2.1.1

Could you please add a NEWS entry describing the changes?

@simonpcouch
Copy link
Collaborator

Hey @ablack3, would be glad to bring these changes into dbplyr with the changes suggested above! Would you be interested in finishing this one off by adding a NEWS entry?

@ablack3
Copy link
Contributor Author

ablack3 commented Oct 28, 2024

Hi @simonpcouch, apologies for the delay. I added a news entry. Thank you!

@simonpcouch simonpcouch merged commit c7a6d02 into tidyverse:main Oct 31, 2024
13 checks passed
@simonpcouch
Copy link
Collaborator

Thank you, @ablack3!

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.

Spark SQL translate_sql for "add_years" is double-quoting column name 'foo'
2 participants