Skip to content

fix fread(..., nrows=0) infinite loop#5869

Merged
jangorecki merged 8 commits intomasterfrom
fread_nrows=0
Jan 2, 2024
Merged

fix fread(..., nrows=0) infinite loop#5869
jangorecki merged 8 commits intomasterfrom
fread_nrows=0

Conversation

@ben-schwen
Copy link
Copy Markdown
Member

@ben-schwen ben-schwen commented Dec 31, 2023

Closes #5868
Follow up to #5253

  • fix escape read jump for extraRows if nrows==0
  • NEWS
  • tests

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 31, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (62b1044) 97.47% compared to head (c127b9a) 97.47%.
Report is 53 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5869   +/-   ##
=======================================
  Coverage   97.47%   97.47%           
=======================================
  Files          80       80           
  Lines       14829    14829           
=======================================
+ Hits        14454    14455    +1     
+ Misses        375      374    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jangorecki
Copy link
Copy Markdown
Member

From news entry it sounds like it still fits into 1.15.0, right?

@ben-schwen
Copy link
Copy Markdown
Member Author

Yes, will try to find a good tests example (besides the one uploaded by Hugh).

@jangorecki jangorecki added this to the 1.15.0 milestone Jan 1, 2024
Comment thread inst/tests/tests.Rraw Outdated
@ben-schwen
Copy link
Copy Markdown
Member Author

Found one. Example has to be big enough to trigger a jump and enough blanks so we get an invalid header position after a jump.

@ben-schwen ben-schwen marked this pull request as ready for review January 1, 2024 14:53
@ben-schwen ben-schwen requested a review from mattdowle as a code owner January 1, 2024 14:53
Comment thread NEWS.md
2. `print(DT, trunc.cols=TRUE)` and the corresponding `datatable.print.trunc.cols` option (new feature 3 in v1.13.0) could incorrectly display an extra column, [#4266](https://github.com/Rdatatable/data.table/issues/4266). Thanks to @tdhock for the bug report and @MichaelChirico for the PR.

3. `fread(..., nrows=0L)` now works as intended and the same as `nrows=0`; i.e. returning the column names and typed empty columns determined by the large sample, [#4686](https://github.com/Rdatatable/data.table/issues/4686), [#4029](https://github.com/Rdatatable/data.table/issues/4029). Thanks to @hongyuanjia and @michaelpaulhirsch for reporting, and Benjamin Schwendinger for the PR.
3. `fread(..., nrows=0L)` now works as intended and the same as `nrows=0`; i.e. returning the column names and typed empty columns determined by the large sample, [#4686](https://github.com/Rdatatable/data.table/issues/4686), [#4029](https://github.com/Rdatatable/data.table/issues/4029). Thanks to @hongyuanjia and @michaelpaulhirsch for reporting, and Benjamin Schwendinger for the PR. Also thanks to @HughParsonage for testing dev and reporting a bug which was fixed before release.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you clarify what you mean by 'the same as nrows=0'? Do you mean the 0L had different behaviour to 0?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, see also #4686.

@jangorecki jangorecki merged commit eda3b09 into master Jan 2, 2024
@jangorecki jangorecki deleted the fread_nrows=0 branch January 2, 2024 14:56
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.

fread(nrows = 0) for a particular file enters infinite loop in dev

4 participants