linyiru opened a new pull request, #12501: URL: https://github.com/apache/arrow-rs/pull/12501
# Which issue does this PR close? - Closes #12496. # Rationale for this change The Arrow reader clamps its batch size by `FileMetaData.num_rows`. `parquet-testing/data/repeated_no_annotation.parquet` has that count at 0 and six rows in its row group, so the batch size becomes 0 and `ParquetRecordBatchReader` returns no rows and no error. The record API and pyarrow read six rows. # What changes are included in this PR? Both clamps, in `ArrowReaderBuilder::with_batch_size` and in `ParquetRecordBatchReaderBuilder::build`, use the number of rows the row groups declare. The clamp is there to avoid a large allocation for a small file, and the row groups are what the reader decodes. # Are these changes tested? Yes. `test_file_row_count_of_zero` reads `repeated_no_annotation.parquet` with the default batch size and with an explicit one, and expects six rows. On `main` it gets zero. # Are there any significant user-facing changes? A file whose file-level row count is lower than the total of its row groups now returns batches of the requested size, and all of its rows when that count is zero. # AI usage disclosure Claude Code found the problem while fuzzing the reader with corrupted files, and generated the fix, the test and this description. The test was run on `main` with and without the fix. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
