prawalpokharel commented on PR #55660:
URL: https://github.com/apache/arrow/pull/55660#issuecomment-7015545791

   Errors from inside the plan don't take that path. `SinkNode` never pushes an 
error into its generator: when a node fails, the plan aborts, 
`SinkNode::StopProducingImpl()` closes the producer, and the scan generator 
sees end-of-stream and waits on `plan->finished()`, which then fails with the 
plan's error. So a failing fragment reaches `ReadNext()` and `Close()` only 
after the plan has finished. I checked this with an instrumented build and the 
`FailingFragment` from `scanner_test.cc`, reading to the error with and without 
threads and closing early with threads. In 20 runs of each case, the plan had 
always finished before `ReadNext()` or `Close()` returned.
   
   You're right about errors raised after the sink, though. 
`ToEnumeratedRecordBatch()` can fail, for example on an allocation failure in 
`ExecBatch::ToRecordBatch()`, and that error skips the wait. I injected one 
during `Close()`'s drain. In the runs where it fired, the stopped plan happened 
to finish first, but nothing on that path waits for it. So the sentence in 
`scanner.h` promised too much. I've pushed a commit that drops it and keeps the 
note about in-flight reads. If you'd rather keep the guarantee, the generator's 
error path could stop the plan and wait on `plan->finished()` the way the 
end-of-stream path does.
   


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