fornwall opened a new pull request, #10844:
URL: https://github.com/apache/arrow-rs/pull/10844

   # Which issue does this PR close?
   
   No issue filed (this is a minor fix).
   
   # Rationale for this change
   
   `get_stream_schema` discarded the producer's message entirely, reporting 
only the numeric return code, so a failed import left the consumer with nothing 
but an errno.
   
   `Iterator::next` did the opposite, unwrapping the producer's message without 
checking there was one. The C stream interface lets `get_last_error` return 
`NULL` when no detailed description is available, so a conforming producer that 
reported a failure without a message made the consumer panic across an FFI 
boundary instead of returning an error.
   
   # What changes are included in this PR?
   
   `get_stream_schema` and `Iterator::next` now includes the producer's error 
message when there is one.
   
   # Are these changes tested?
   
   Yes. `test_error_import` now asserts the full message that a failing Rust 
producer surfaces through a round trip. New tests drive a hand-written producer 
through both the schema and the `next` path, covering: a producer message, 
`get_last_error` returning NULL, and a NULL `get_last_error` callback. The 
NULL-message case panicked before this change.
   
   # Are there any user-facing changes?
   
   No API changes; error messages change:
   
   * A failed schema import previously read `Cannot get schema from input 
stream. Error code: 5`, and now appends `. Producer error: <message>` when the 
producer supplies one.
   * A failed `next()` previously surfaced the producer's message alone (e.g. 
`Memory error: out of memory`), and now reads `Cannot get next batch from input 
stream. Error code: 12. Producer error: Memory error: out of memory`.
   
   ---
   
   AI usage: Created with claude code and opus 5. I have reviewed the code and 
iterated on it.


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