Skip to content

[Bug] numRows(0) stops reading instead of disabling the row limit #1149

Description

@Aias00

Fesod version

Current main at 5a9a16b.

Description

The documentation defines numRows = 0 as unlimited, but the default ReadListener#hasNext treats zero as an active limit and stops before delivering the first row.

Location

  • fesod-sheet/src/main/java/org/apache/fesod/sheet/read/listener/ReadListener.java:101-106
  • website/docs/sheet/read/num-rows.md:32
  • website/docs/sheet/help/parameter.md:163,175

Reproduction

Reading the same three-row workbook produced these results:

no numRows setting: 3 rows
numRows(0):          0 rows
numRows(1):          1 row

At row index 0, the current condition limit != null && index >= limit evaluates to true for a zero limit.

Expected behavior

numRows(0) should behave like no row limit, as documented, across XLSX, XLS, and CSV.

Suggested fix

Apply the limit only when it is positive and add a parameterized regression test for all supported read formats.

Related existing work

Issues #151, #661, and #937 cover other numRows behavior, primarily callbacks and multi-sheet reads. They do not cover the documented zero sentinel.

Are you willing to submit a PR?

Yes.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions