Tristan1900 opened a new pull request, #23243:
URL: https://github.com/apache/datafusion/pull/23243

   ## Which issue does this close?
   
   Closes #23242.
   
   ## Rationale for this change
   
   When the input to a `BufferExec` panics, the panic unwinds the background 
producer task (`MemoryBufferedStream`), tokio catches it at the task boundary, 
and the dropped sender looks like a clean end-of-stream to the consumer. A 
panic isn't a `Result::Err`, so it also skips the `batch_tx.send(Err(..))` path 
— the partition gets silently truncated and the query returns partial results 
instead of failing. More detail in #23242.
   
   ## What changes are included in this PR?
   
   Catch the panic at the input poll inside `MemoryBufferedStream` and forward 
it as a `DataFusionError` over the channel the consumer already drains, so it 
propagates instead of being swallowed.
   
   I went with surfacing it as an error rather than re-raising via 
`join_unwind` (the way `RecordBatchReceiverStream` does), since the consumer 
already handles `Some(Err(..))` and this fails only the query. Happy to switch 
to a re-raise if that's preferred for consistency.
   
   ## Are these changes tested?
   
   Yes — added `panic_in_input_is_propagated`, which feeds a stream that panics 
partway through and asserts the buffered stream yields an error instead of 
finishing cleanly.
   
   ## Are there any user-facing changes?
   
   A query whose input panics under a `BufferExec` now fails with an error 
instead of silently returning truncated results. No API 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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to