-
Notifications
You must be signed in to change notification settings - Fork 185
Sql server count big #1501
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
Sql server count big #1501
Changes from 9 commits
0313c68
3936207
829a9c6
7c4edde
3e2679b
65b1826
b517341
dc588f5
7cef8f1
acf63fd
d329206
cc271f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -425,6 +425,10 @@ simulate_mssql <- function(version = "15.0") { | |
| sql_variant( | ||
| mssql_scalar, | ||
| sql_translator(.parent = base_odbc_agg, | ||
| # Use COUNT_BIG to ensure result is always returned regardless of table size | ||
| # COUNT errors if more than 2,147,483,647 rows are present due to an integer overflow | ||
| # https://learn.microsoft.com/en-us/sql/t-sql/functions/count-transact-sql?view=sql-server-ver17 | ||
| n = function() sql("COUNT_BIG(*)"), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please include a comment with a link to the docs? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, now added! |
||
| sd = sql_aggregate("STDEV", "sd"), | ||
| var = sql_aggregate("VAR", "var"), | ||
| str_flatten = function(x, collapse = "") sql_expr(string_agg(!!x, !!collapse)), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -497,6 +497,38 @@ | |
| FROM `df` | ||
| ORDER BY `y` | ||
|
|
||
| # count_big | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where did these snapshots come from? I don't see a corresponding test. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, not sure how that happened. Have now added test and updated snapshots |
||
|
|
||
| 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 | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.