1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
test_that("custom scalar translated correctly", {
local_con(simulate_odbc())
expect_equal(translate_sql(as.numeric(x)), sql("CAST(`x` AS DOUBLE)"))
expect_equal(translate_sql(as.double(x)), sql("CAST(`x` AS DOUBLE)"))
expect_equal(translate_sql(as.integer(x)), sql("CAST(`x` AS INT)"))
expect_equal(translate_sql(as.character(x)), sql("CAST(`x` AS STRING)"))
})
test_that("custom aggregators translated correctly", {
local_con(simulate_odbc())
expect_equal(
translate_sql(sd(x, na.rm = TRUE), window = FALSE),
sql("STDDEV_SAMP(`x`)")
)
})
test_that("custom window functions translated correctly", {
local_con(simulate_odbc())
expect_equal(
translate_sql(sd(x, na.rm = TRUE)),
sql("STDDEV_SAMP(`x`) OVER ()")
)
})
|