QuakeWang commented on code in PR #1947:
URL: 
https://github.com/apache/datafusion-ballista/pull/1947#discussion_r3524421345


##########
ballista-cli/src/tui/domain/jobs.rs:
##########
@@ -117,9 +117,16 @@ impl JobsData {
                 }
             }),
             SortColumn::StagesCompleted => jobs.sort_by(|a, b| {
-                let a_stages = a.completed_stages / a.num_stages;
-                let b_stages = b.completed_stages / b.num_stages;
-                let cmp = a_stages.cmp(&b_stages);
+                let stage_completion = |job: &Job| {
+                    if job.num_stages == 0 {
+                        (0_u128, 1_u128)
+                    } else {
+                        (job.completed_stages as u128, job.num_stages as u128)

Review Comment:
   @coderfender Good point. I switched this to compare f64 completion ratios 
with total_cmp while keeping the zero-stage guard. The exact u128 fraction 
comparison was more defensive than this TUI sorting path needs.



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