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

readODS #211 Dataframe with nothing but spaces leads to an integer guessing error #37

Closed
chainsawriot opened this issue Jan 4, 2025 · 1 comment

Comments

@chainsawriot
Copy link
Collaborator

see ropensci/readODS#211

buggy <- structure(list(picture_archive_url = c("", "", "", "", ""), video_url = c(" ", 
" ", " ", " ", " ")), row.names = c(NA, -5L), class = "data.frame")

buggy
#>   picture_archive_url video_url
#> 1                              
#> 2                              
#> 3                              
#> 4                              
#> 5

minty::type_convert(buggy)
#> Error: basic_string::substr: __pos (which is 18446744073709551615) > this->size() (which is 1)

Created on 2025-01-04 with reprex v2.1.1

V3 in the original error report does not contain spaces, so there is no error.

@chainsawriot
Copy link
Collaborator Author

To narrow it down even further

minty:::guess_parser(c(" "), trim_ws = TRUE)
#> Error: basic_string::substr: __pos (which is 18446744073709551615) > this->size() (which is 1)

Created on 2025-01-04 with reprex v2.1.1

In fact, readr:::guess_parser does not have this problem because trim_ws is not implemented.

chainsawriot added a commit that referenced this issue Jan 5, 2025
The string trimming function didn't check for missing. Now it's
checked.

Also, to emulate the behavior of `readxl`, all space columns should be
detected as logical.

benchmark pending
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

No branches or pull requests

1 participant