Skip to content

Conversation

@edward-burn
Copy link
Contributor

@edward-burn edward-burn commented May 15, 2024

Use COUNT_BIG instead of COUNT for sql server so as to avoid overflow error for very large tables #1498

sql_variant(
mssql_scalar,
sql_translator(.parent = base_odbc_agg,
n = function() sql("COUNT_BIG(*)"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please include a comment with a link to the docs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, now added!

Co-authored-by: Hadley Wickham <[email protected]>
FROM `df`
ORDER BY `y`

# count_big
Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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

test_that("count_big", {
mf <- lazy_frame(x = c(1:5), y = c(rep("A", 5)), con = simulate_mssql())
expect_snapshot(count(mf))
expect_snapshot(tally(mf))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think one snapshot test is adequate here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Have removed the second one

@hadley hadley merged commit ed3a5a6 into tidyverse:main Sep 3, 2025
15 checks passed
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.

3 participants