avantgardnerio commented on code in PR #153:
URL: https://github.com/apache/arrow-ballista/pull/153#discussion_r955074978


##########
ballista/rust/scheduler/src/state/execution_graph.rs:
##########
@@ -410,87 +594,33 @@ impl ExecutionGraph {
         session_ctx: &SessionContext,
     ) -> Result<ExecutionGraph> {
         let mut stages: HashMap<usize, ExecutionStage> = HashMap::new();
-        for stage in proto.stages {
-            let plan_proto = U::try_decode(stage.plan.as_slice())?;
-            let plan = plan_proto.try_into_physical_plan(
-                session_ctx,
-                session_ctx.runtime_env().as_ref(),
-                codec.physical_extension_codec(),
-            )?;
-
-            let stage_id = stage.stage_id as usize;
-            let partitions: usize = stage.partitions as usize;
-
-            let mut task_statuses: Vec<Option<task_status::Status>> =
-                vec![None; partitions];
-
-            for status in stage.task_statuses {
-                if let Some(task_id) = status.task_id.as_ref() {
-                    task_statuses[task_id.partition_id as usize] = 
status.status
+        for graph_stage in proto.stages {
+            let stage_type = graph_stage.stage_type.expect("Unexpected empty 
stage");

Review Comment:
   Trivia: I have learned recently that the `?` operator works with `Option<>`s 
as well as `Results<>` if the outer function itself also returns an option.
   
   Here it would need to be mapped to a `Result<>` though:
   
   ```suggestion
               let stage_type = 
graph_stage.stage_type.ok_or(BallistaError::Internal("Unexpected empty 
stage"))?;
   ```



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to