kylebarron commented on PR #975:
URL: 
https://github.com/apache/datafusion-python/pull/975#issuecomment-2549231264

   This PR changes the behavior of `stream.next()` to raise `StopIteration` 
when there are no more batches available in the stream.
   
   This matches default iterator behavior:
   
   <img width="243" alt="image" 
src="https://github.com/user-attachments/assets/914a01fb-b184-4d23-af74-881dc67e4e35";
 />
   
   This also matches `pyarrow.RecordBatchReader` behavior
   
   ```py
   In [11]: import pyarrow as pa
   
   In [12]: batch = pa.record_batch([])
   
   In [13]: batch2 = pa.record_batch([])
   
   In [15]: reader = pa.RecordBatchReader.from_batches(batch.schema, [batch, 
batch2])
   
   In [16]: reader.read_next_batch()
   Out[16]:
   pyarrow.RecordBatch
   
   ----
   
   In [17]: reader.read_next_batch()
   Out[17]:
   pyarrow.RecordBatch
   
   ----
   
   In [18]: reader.read_next_batch()
   ---------------------------------------------------------------------------
   StopIteration                             Traceback (most recent call last)
   Cell In[18], line 1
   ----> 1 reader.read_next_batch()
   
   File 
~/.pyenv/versions/3.11.8/lib/python3.11/site-packages/pyarrow/ipc.pxi:708, in 
pyarrow.lib.RecordBatchReader.read_next_batch()
   
   StopIteration:
   ```


-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to