mikamikasuki opened a new pull request, #55245:
URL: https://github.com/apache/arrow/pull/55245

   ### Rationale for this change
   
   An exported TableBatchReader can outlive the temporary Ruby Table used to 
create it. The reader currently holds a reference to the Table, so importing 
the stream after Ruby garbage collection can segfault.
   
   ### What changes are included in this PR?
   
   Construct TableBatchReader with its shared_ptr<Table> so it retains the 
source table for the reader’s lifetime.
   
   ### Are these changes tested?
   
   Added a Ruby regression that exports a reader from a temporary table, runs 
GC, imports the stream, and reads all rows. The regression segfaults on current 
main and passes with this change. The full record-batch-reader test file passes 
(4 tests, 4 assertions). The Arrow C++ core, GLib bindings, and Ruby extension 
build succeeded.
   
   ### Are there any user-facing changes?
   
   This prevents a segmentation fault when an exported TableBatchReader is used 
after its source Ruby table wrapper is garbage-collected.
   
   **This PR contains a "Critical Fix".** It prevents a crash when the source 
table is collected before the exported reader stream is used.
   
   ### Was AI used for this PR?
   
   OpenAI Codex assisted with root-cause analysis, implementation, and 
regression-test generation. The contributor reviewed the code and regression 
output.
   
   **PR code and description written by:**
   
   - [ ] Human
   - [x] AI
   
   **Reviewed before submission by:**
   
   - [x] Human
   - [ ] AI
   - [ ] Not reviewed
   
   Closes #54689


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