Repository navigation
Conversation
The default ReadListener#hasNext applied any non-null limit, so numRows(0) stopped the read before the first row. The documentation defines zero as "no limit on the number of rows, i.e. read all rows". Only apply the limit when it is positive, and add a parameterized regression test over all supported read formats covering the zero sentinel, the omitted setting and a positive limit that still stops early. Closes apache#1149
Contributor
Author
|
Closing in favor of #1159 — the core change is identical (only a positive limit should stop the read). I left a suggestion there to also guard the omitted- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
The default
ReadListener#hasNextnow applies thenumRowslimit only when it is positive. Zero — documented as "no limit on the number of rows, i.e. read all rows" — previously stopped the read before the first row.Why
The row index starts at the head row, so a zero limit failed
index >= limitfor every row including the first one.Fixes #1149
How tested
New
NumRowsReadLimitTest, parameterized over XLSX / XLS / CSV via@ExcelFormatSourceon headless workbooks (so the limit maps one-to-one onto data rows):numRows(0)reads all rows, same as omitting the settingnumRows(1)) still stops the read earlyFull
fesod-sheetsuite passes locally on Temurin 25;spotless:checkclean.