Skip to content

Commit 51057cd

Browse files
committed
add fix + NEWS
1 parent 67db7f7 commit 51057cd

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@
333333
334334
19. Ellipsis elements like `..1` are correctly excluded when searching for variables in "up-a-level" syntax inside `[`, [#5460](https://github.com/Rdatatable/data.table/issues/5460). Thanks @ggrothendieck for the report and @MichaelChirico for the fix.
335335
336+
20. `fread()` now adds a small safety margin when reallocating for a reread after out-of-sample type bumps, so that healed rows when `fill=TRUE` cannot outrun the resized table, [#5110](https://github.com/Rdatatable/data.table/issues/5110). Thanks to @kmichelson for the report and @ben-schwen for the fix.
337+
336338
### NOTES
337339
338340
1. The following in-progress deprecations have proceeded:

src/fread.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2870,7 +2870,9 @@ int freadMain(freadMainArgs _args)
28702870
size[j] = 0;
28712871
}
28722872
}
2873-
allocateDT(type, size, ncol, ncol - nStringCols - nNonStringCols, DTi);
2873+
// When type bump with fill occurs, reallocate with DTi (rows read so far) plus a buffer
2874+
// Using DTi alone could be short #5110
2875+
allocateDT(type, size, ncol, ncol - nStringCols - nNonStringCols, DTi + (fill > 0 ? (DTi / 10) + 1 : 0));
28742876
// reread from the beginning
28752877
DTi = 0;
28762878
headPos = pos;

0 commit comments

Comments
 (0)