Skip to content
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

Fix overflow during indexing for data with more than 2B entries #183

Merged
merged 2 commits into from Oct 3, 2019

Conversation

wlattner
Copy link
Contributor

@wlattner wlattner commented Oct 3, 2019

This PR fixes an overflow during indexing. This causes the error below when reading a file with more than 2B entries.

m <- data.frame(x1 = rep(0, 1e9), x2 = rep(1, 1e9), x3 = rep(2, 1e9))

f <- tempfile()
vroom::vroom_write(m, f)

df <- vroom::vroom(f)
#> Error in vroom_(file, delim = delim, col_names = col_names, col_types = col_types,  : 
    Failure to retrieve index 184,467,440,724,145,845 / 6,148,914,690,804,861,440 

I am able to reproduce this on MacOS with clang 6 and Ubuntu with gcc 7.4. In both cases, the literal 0 starting value for std::accumulate is interpreted as int rather than size_t.

@jimhester
Copy link
Collaborator

Thanks! Looks good!
Great work, this package is now better thanks to you!

Thanks!! You are da bomb!

@jimhester jimhester merged commit be65631 into tidyverse:master Oct 3, 2019
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.

None yet

2 participants