coderfender commented on code in PR #21030:
URL: https://github.com/apache/datafusion/pull/21030#discussion_r2986133666


##########
datafusion/ffi/src/execution_plan.rs:
##########
@@ -112,35 +113,35 @@ unsafe extern "C" fn properties_fn_wrapper(
 
 unsafe extern "C" fn children_fn_wrapper(
     plan: &FFI_ExecutionPlan,
-) -> RVec<FFI_ExecutionPlan> {
-    let runtime = plan.runtime();
-    let plan = plan.inner();
-
-    let children: Vec<_> = plan
-        .children()
-        .into_iter()
-        .map(|child| FFI_ExecutionPlan::new(Arc::clone(child), 
runtime.clone()))
-        .collect();
+) -> SVec<FFI_ExecutionPlan> {
+    unsafe {
+        let private_data = plan.private_data as *const 
ExecutionPlanPrivateData;
+        let plan = &(*private_data).plan;
+        let runtime = &(*private_data).runtime;
 
-    children.into()
+        plan.children()
+            .into_iter()
+            .map(|child| FFI_ExecutionPlan::new(Arc::clone(child), 
runtime.clone()))
+            .collect()
+    }
 }
 
 unsafe extern "C" fn with_new_children_fn_wrapper(
     plan: &FFI_ExecutionPlan,
-    children: RVec<FFI_ExecutionPlan>,
+    children: SVec<FFI_ExecutionPlan>,
 ) -> FFIResult<FFI_ExecutionPlan> {
     let runtime = plan.runtime();
-    let plan = Arc::clone(plan.inner());
-    let children = rresult_return!(
-        children
-            .iter()
-            .map(<Arc<dyn ExecutionPlan>>::try_from)
-            .collect::<Result<Vec<_>>>()
-    );
+    let inner_plan = Arc::clone(plan.inner());
+
+    let children: Result<Vec<Arc<dyn ExecutionPlan>>> = children
+        .iter()
+        .map(<Arc<dyn ExecutionPlan>>::try_from)
+        .collect();
 
-    let new_plan = rresult_return!(plan.with_new_children(children));
+    let children = rresult_return!(children);

Review Comment:
   Done 💯 



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to