eric-wang-1990 opened a new pull request, #4133:
URL: https://github.com/apache/arrow-adbc/pull/4133

   ## Summary
   
   - Fix infinite loop in `AdbcDataReader.Read()` when 
`ReadNextRecordBatchAsync()` throws mid-stream
   - Clear `this.recordBatch` before calling `.Result` so retried `Read()` 
calls don't re-serve stale rows
   
   ## Problem
   
   When `ReadNextRecordBatchAsync().Result` throws (e.g., server error 
mid-stream), `AdbcDataReader.Read()` does not clear `this.recordBatch`. If the 
caller retries `Read()`:
   
   1. `recordBatch` is still non-null (from the last successful fetch)
   2. `currentRowInRecordBatch` was reset to 0 by `ReadNextRecordBatchAsync()` 
before it threw
   3. `Read()` returns `true` and the caller re-reads all stale rows
   4. When the stale batch is exhausted, `ReadNextRecordBatchAsync()` throws 
again
   5. Infinite loop: throw → re-read stale batch → throw → re-read stale batch
   
   This was observed with Power BI Desktop, which retries `Read()` after 
exceptions, causing it to hang forever with a loading spinner instead of 
surfacing the error to the user.
   
   ## Fix
   
   Set `this.recordBatch = null` before calling `.Result`. On exception, the 
batch is already cleared, so retry calls fall through to fetch again (which 
re-throws the error).
   
   ## Test plan
   
   - [ ] Verified with Power BI Desktop: error now surfaces correctly instead 
of infinite hang
   - [ ] Existing unit tests pass
   - [ ] Manual test: stop SQL warehouse mid-query → PBI shows error dialog 
instead of spinner
   
   This pull request was AI-assisted by Isaac.


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