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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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?

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.

2 participants