Skip to content

Commit

Permalink
Merge branch 'sql_server_count_big' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
catalamarti authored Dec 4, 2024
2 parents 3e2679b + 7c4edde commit 65b1826
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

* `across(everything())` doesn't select grouping columns created via `.by` in
`summarise()` (@mgirlich, #1493).
* Use `COUNT_BIG` instead of `COUNT` for SQL server so that `tally()` and
`count()` work regardless of size of the data (@edward-burn, #1498).

* New translations of clock function `date_count_between()` for SQL server, Redshift, Snowflake, Postgres, and Spark (@edward-burn, #1495).

Expand Down
1 change: 1 addition & 0 deletions R/backend-mssql.R
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ simulate_mssql <- function(version = "15.0") {
sql_variant(
mssql_scalar,
sql_translator(.parent = base_odbc_agg,
n = function() sql("COUNT_BIG(*)"),
sd = sql_aggregate("STDEV", "sd"),
var = sql_aggregate("VAR", "var"),
str_flatten = function(x, collapse = "") sql_expr(string_agg(!!x, !!collapse)),
Expand Down
32 changes: 32 additions & 0 deletions tests/testthat/_snaps/backend-mssql.md
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,38 @@
FROM `df`
ORDER BY `y`

# count_big

Code
dplyr::count(mf)
Output
<SQL>
SELECT COUNT_BIG(*) AS `n`
FROM `df`

---

Code
dplyr::tally(mf)
Output
<SQL>
SELECT COUNT_BIG(*) AS `n`
FROM `df`

# can copy_to() and compute() with temporary tables (#438)

Code
db <- copy_to(con, df, name = unique_table_name(), temporary = TRUE)
Message
Created a temporary table named #dbplyr_{tmp}

---

Code
db2 <- db %>% mutate(y = x + 1) %>% compute()
Message
Created a temporary table named #dbplyr_{tmp}

# add prefix to temporary table

Code
Expand Down

0 comments on commit 65b1826

Please sign in to comment.