amol- commented on code in PR #12765:
URL: https://github.com/apache/arrow/pull/12765#discussion_r842985580


##########
python/pyarrow/_exec_plan.pyx:
##########
@@ -81,21 +93,32 @@ cdef execplan(inputs, output_type, vector[CDeclaration] 
plan, c_bool use_threads
     # Create source nodes for each input
     for ipt in inputs:
         if isinstance(ipt, Table):
+            node_factory = "source"
             c_in_table = pyarrow_unwrap_table(ipt).get()
             c_sourceopts = GetResultValue(
                 CSourceNodeOptions.FromTable(deref(c_in_table), 
deref(c_exec_context).executor()))
+            c_input_node_opts = static_pointer_cast[CExecNodeOptions, 
CSourceNodeOptions](c_sourceopts)
+        elif isinstance(ipt, Dataset):
+            node_factory = "scan"
+            c_in_dataset = (<Dataset>ipt).unwrap()
+            c_scanopts = make_shared[CScanNodeOptions](
+                c_in_dataset, make_shared[CScanOptions]())
+            deref(deref(c_scanopts).scan_options).use_threads = use_threads
+            c_input_node_opts = static_pointer_cast[CExecNodeOptions, 
CScanNodeOptions](c_scanopts)
         else:
             raise TypeError("Unsupported type")
 
         if plan_iter != plan.end():
             # Flag the source as the input of the first plan node.
             deref(plan_iter).inputs.push_back(CDeclaration.Input(
-                CDeclaration(tobytes("source"), deref(c_sourceopts))
+                CDeclaration(tobytes(node_factory),
+                             no_c_inputs, c_input_node_opts)

Review Comment:
   The `Declaration` constructor accepting a `shared_ptr<ExecNodeOptions>`, the 
other constructors accept an instance of the class itself instead of a 
`shared_ptr` which makes harder to declare the variable once at the begin 
because that would instantiate 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