@@ -34,8 +34,8 @@ use crate::config::FFI_ConfigOptions;
3434use crate :: execution:: FFI_TaskContext ;
3535use crate :: plan_properties:: FFI_PlanProperties ;
3636use crate :: record_batch_stream:: FFI_RecordBatchStream ;
37- use crate :: util:: { FFIResult , FfiOption } ;
38- use crate :: { df_result, rresult , rresult_return } ;
37+ use crate :: util:: { FFI_Option , FFIResult } ;
38+ use crate :: { df_result, sresult , sresult_return } ;
3939
4040/// A stable struct for sharing a [`ExecutionPlan`] across FFI boundaries.
4141#[ repr( C ) ]
@@ -66,7 +66,7 @@ pub struct FFI_ExecutionPlan {
6666 target_partitions : usize ,
6767 config : FFI_ConfigOptions ,
6868 )
69- -> FFIResult < FfiOption < FFI_ExecutionPlan > > ,
69+ -> FFIResult < FFI_Option < FFI_ExecutionPlan > > ,
7070
7171 /// Used to create a clone on the provider of the execution plan. This should
7272 /// only need to be called by the receiver of the plan.
@@ -114,16 +114,12 @@ unsafe extern "C" fn properties_fn_wrapper(
114114unsafe extern "C" fn children_fn_wrapper (
115115 plan : & FFI_ExecutionPlan ,
116116) -> SVec < FFI_ExecutionPlan > {
117- unsafe {
118- let private_data = plan. private_data as * const ExecutionPlanPrivateData ;
119- let plan = & ( * private_data) . plan ;
120- let runtime = & ( * private_data) . runtime ;
121-
122- plan. children ( )
123- . into_iter ( )
124- . map ( |child| FFI_ExecutionPlan :: new ( Arc :: clone ( child) , runtime. clone ( ) ) )
125- . collect ( )
126- }
117+ let runtime = plan. runtime ( ) ;
118+ plan. inner ( )
119+ . children ( )
120+ . into_iter ( )
121+ . map ( |child| FFI_ExecutionPlan :: new ( Arc :: clone ( child) , runtime. clone ( ) ) )
122+ . collect ( )
127123}
128124
129125unsafe extern "C" fn with_new_children_fn_wrapper (
@@ -138,10 +134,10 @@ unsafe extern "C" fn with_new_children_fn_wrapper(
138134 . map ( <Arc < dyn ExecutionPlan > >:: try_from)
139135 . collect ( ) ;
140136
141- let children = rresult_return ! ( children) ;
142- let new_plan = rresult_return ! ( inner_plan. with_new_children( children) ) ;
137+ let children = sresult_return ! ( children) ;
138+ let new_plan = sresult_return ! ( inner_plan. with_new_children( children) ) ;
143139
144- crate :: ffi_option:: FfiResult :: Ok ( FFI_ExecutionPlan :: new ( new_plan, runtime) )
140+ crate :: ffi_option:: FFI_Result :: Ok ( FFI_ExecutionPlan :: new ( new_plan, runtime) )
145141}
146142
147143unsafe extern "C" fn execute_fn_wrapper (
@@ -155,7 +151,7 @@ unsafe extern "C" fn execute_fn_wrapper(
155151
156152 let _runtime_guard = runtime. as_ref ( ) . map ( |rt| rt. enter ( ) ) ;
157153
158- rresult ! (
154+ sresult ! (
159155 plan. execute( partition, ctx)
160156 . map( |rbs| FFI_RecordBatchStream :: new( rbs, runtime) )
161157 )
@@ -165,13 +161,13 @@ unsafe extern "C" fn repartitioned_fn_wrapper(
165161 plan : & FFI_ExecutionPlan ,
166162 target_partitions : usize ,
167163 config : FFI_ConfigOptions ,
168- ) -> FFIResult < FfiOption < FFI_ExecutionPlan > > {
164+ ) -> FFIResult < FFI_Option < FFI_ExecutionPlan > > {
169165 let maybe_config: Result < ConfigOptions , DataFusionError > = config. try_into ( ) ;
170- let config = rresult_return ! ( maybe_config) ;
166+ let config = sresult_return ! ( maybe_config) ;
171167 let runtime = plan. runtime ( ) ;
172168 let plan = plan. inner ( ) ;
173169
174- rresult ! (
170+ sresult ! (
175171 plan. repartitioned( target_partitions, & config)
176172 . map( |maybe_plan| maybe_plan
177173 . map( |plan| FFI_ExecutionPlan :: new( plan, runtime) )
0 commit comments