nkuprins opened a new pull request, #961:
URL: https://github.com/apache/fesod/pull/961
## Purpose of the pull request
Closed: #960
`PageReadListener` re-delivers the previous sheet's leftover rows when a
single listener reads multiple sheets (`doReadAll()`) with a batch size greater
than 1, so the consumer processes those rows twice.
## What's changed?
`doAfterAllAnalysed` flushes the partially filled batch at the end of each
sheet, but kept the delivered rows in `cachedDataList`. Since
`DefaultAnalysisEventProcessor.endSheet` invokes `doAfterAllAnalysed` after
every sheet and the same listener instance serves all sheets, the next sheet
kept appending to the already-delivered list and re-emitted its rows as soon as
the batch filled up.
The fix is a one-line reset of `cachedDataList` after the end-of-sheet
flush, mirroring what `invoke` already does after delivering a full batch.
Regression test: `SimpleDataTest.pageReadListenerMultipleSheets07` writes a
two-sheet workbook (3 + 4 rows), reads all sheets with batch size 5, and
asserts the exact delivered sequence. On current `main` it fails with sheet0's
three rows delivered twice (10 deliveries instead of 7):
```
expected: <[FirstName0, FirstName1, FirstName2, SecondName0, SecondName1,
SecondName2, SecondName3]>
but was: <[FirstName0, FirstName1, FirstName2, FirstName0, FirstName1,
FirstName2, SecondName0, SecondName1, SecondName2, SecondName3]>
```
## Checklist
- [x] I have read the [Contributor
Guide](https://fesod.apache.org/community/contribution/).
- [ ] I have written the necessary doc or comment.
- [x] I have added the necessary unit tests and all cases have passed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]