Skip to content

Commit

Permalink
Fix add_years translation on spark
Browse files Browse the repository at this point in the history
  • Loading branch information
ablack3 committed Jun 5, 2024
1 parent 8f2fcb0 commit b1153b7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/backend-spark-sql.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ simulate_spark_sql <- function() simulate_dbi("Spark SQL")
},
add_years = function(x, n, ...) {
check_dots_empty()
sql_expr(add_months(!!!x, !!n*12))
sql_expr(add_months(!!x, !!n*12))
},
date_build = function(year, month = 1L, day = 1L, ..., invalid = NULL) {
sql_expr(make_date(!!year, !!month, !!day))
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-backend-spark-sql.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
test_that("custom clock functions translated correctly", {
local_con(simulate_spark_sql())
expect_equal(test_translate_sql(add_years(x, 1)), sql("ADD_MONTHS('`x`', 1.0 * 12.0)"))
expect_equal(test_translate_sql(add_years(x, 1)), sql("ADD_MONTHS(`x`, 1.0 * 12.0)"))
expect_equal(test_translate_sql(add_days(x, 1)), sql("DATE_ADD(`x`, 1.0)"))
expect_error(test_translate_sql(add_days(x, 1, "dots", "must", "be empty")))
expect_equal(test_translate_sql(date_build(2020, 1, 1)), sql("MAKE_DATE(2020.0, 1.0, 1.0)"))
Expand Down

0 comments on commit b1153b7

Please sign in to comment.