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

Remove optimisation for na.strings = "" from fread.c #5399

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@

16. The options `datatable.print.class` and `datatable.print.keys` are now `TRUE` by default. They have been available since v1.9.8 (Nov 2016) and v1.11.0 (May 2018) respectively.

17. A defunct code path in `fread` was removed. The code, which had been present for four years, was intended as an optimization for `na.strings = ""` but due to an error was never actually used. The error was uncovered by CRAN's continuous testing which uses a variety of environments to build and test R packages. One of these uses the latest version of the GCC compiler which newly warns on the type of error present here. Thanks to Václav Tlapák for investigating [#5733](https://github.com/Rdatatable/data.table/issues/5377) and the PR [#5399](https://github.com/Rdatatable/data.table/pull/5399).

# data.table [v1.14.2](https://github.com/Rdatatable/data.table/milestone/24?closed=1) (27 Sep 2021)

Expand Down
4 changes: 1 addition & 3 deletions src/fread.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ static inline const char *end_NA_string(const char *start) {
// start should be at the beginning of any potential NA string, after leading whitespace skipped by caller
const char* const* nastr = NAstrings;
const char *mostConsumed = start; // tests 1550* includes both 'na' and 'nan' in nastrings. Don't stop after 'na' if 'nan' can be consumed too.
if (nastr) while (*nastr) {
while (*nastr) {
const char *ch1 = start;
const char *ch2 = *nastr;
while (*ch1==*ch2 && *ch2!='\0') { ch1++; ch2++; }
Expand Down Expand Up @@ -1283,8 +1283,6 @@ int freadMain(freadMainArgs _args) {
while (*nastr) {
if (**nastr == '\0') {
blank_is_a_NAstring = true;
// if blank is the only one, as is the default, clear NAstrings so that doesn't have to be checked
if (nastr==NAstrings && nastr+1==NULL) NAstrings=NULL;
nastr++;
continue;
}
Expand Down