jiangxt2 opened a new pull request, #55774:
URL: https://github.com/apache/arrow/pull/55774

   ### Rationale for this change
   
   `ORCFile.read(columns=[])` and `ORCFile.read_stripe(..., columns=[])` return 
zero rows for nonempty ORC data. An empty projection should retain the number 
of rows, as `ORCFile.iter_batches(columns=[])` already does. This follows the 
discussion in #54926.
   
   ### What changes are included in this PR?
   
   Accumulate the number of rows read from ORC batches when the output schema 
has no fields, and construct a zero-column record batch with that row count. 
The existing C++ read paths and Python interfaces share this behavior. Add C++ 
and Python regression tests for whole-file and stripe reads, multiple stripes, 
empty files, caller-provided schemas and read errors.
   
   ### Are these changes tested?
   
   On macOS arm64 with Release builds, Python 3.13.7 and ORC 2.2.1:
   
   ```bash
   cpp/build/dev/release/arrow-orc-adapter-test
   python -m pytest -q -ra --enable-orc --enable-dataset --enable-pandas 
python/pyarrow/tests/test_orc.py
   ```
   
   The C++ suite passed 48 tests and skipped one existing time-zone database 
test limited to ORC versions before 2.0. The Python ORC suite passed 131 tests. 
C++ and Python format and lint checks passed.
   
   ### Are there any user-facing changes?
   
   Yes. Empty projections through `ORCFile.read()` and `ORCFile.read_stripe()` 
now return the actual number of rows instead of zero.
   
   **This PR contains a "Critical Fix".** The affected reads report an 
incorrect row count for nonempty data.
   
   ### Was AI used for this PR?
   
   **PR code and description written by:**
   
   - [ ] Human
   - [x] AI
   
   **Reviewed before submission by:**
   
   - [ ] Human
   - [x] AI
   - [ ] Not reviewed
   
   OpenAI Codex assisted with the implementation, tests, description, and 
static review. The human contributor directed the scope and approved the 
implementation and test changes.
   


-- 
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]

Reply via email to