File tree Expand file tree Collapse file tree 1 file changed +2
-17
lines changed
Expand file tree Collapse file tree 1 file changed +2
-17
lines changed Original file line number Diff line number Diff line change 1717
1818use std:: collections:: HashMap ;
1919use std:: ffi:: CString ;
20- use std:: os:: raw:: c_void;
2120use std:: sync:: Arc ;
2221
2322use arrow:: array:: { new_null_array, RecordBatch , RecordBatchReader } ;
@@ -964,23 +963,9 @@ impl PyDataFrame {
964963 let reader: Box < dyn RecordBatchReader + Send > = Box :: new ( reader) ;
965964
966965 let stream = FFI_ArrowArrayStream :: new ( reader) ;
967- fn drop_stream ( ptr : * mut FFI_ArrowArrayStream , _ctx : * mut c_void ) {
968- if ptr. is_null ( ) {
969- return ;
970- }
971- unsafe {
972- drop ( Box :: from_raw ( ptr) ) ;
973- }
974- }
975- let stream_ptr = Box :: into_raw ( Box :: new ( stream) ) ;
976966 let name = CString :: new ( "arrow_array_stream" ) . unwrap ( ) ;
977- let capsule = PyCapsule :: new_bound_with_destructor (
978- py,
979- stream_ptr,
980- Some ( name) ,
981- drop_stream as fn ( * mut FFI_ArrowArrayStream , * mut c_void ) ,
982- )
983- . map_err ( py_datafusion_err) ?;
967+
968+ let capsule = PyCapsule :: new ( py, stream, Some ( name) ) . map_err ( py_datafusion_err) ?;
984969 Ok ( capsule)
985970 }
986971
You can’t perform that action at this time.
0 commit comments