You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "QuakeWang (via GitHub)" <gi...@apache.org> on 2026/07/05 02:49:41 UTC
[PR] fix(cli): sort jobs by stage completion ratio [datafusion-ballista]
QuakeWang opened a new pull request, #1947:
URL: https://github.com/apache/datafusion-ballista/pull/1947
# Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
Closes #.
# Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
The TUI jobs table sorted the stage completion column with integer division:
`completed_stages / num_stages`
This could panic when `num_stages` was zero, and it also collapsed partial ratios such as `1/4`, `2/4`, and `3/4` to the same value.
# What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
This PR updates the jobs table stage-completion sorting to compare the actual completion ratio safely, treating zero-stage jobs as `0%` complete. It also adds regression tests for ratio-based sorting and zero-stage jobs.
# Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api change` label.
-->
Yes. Sorting the TUI jobs table by stage completion now reflects the real completion ratio and no longer panics for jobs with zero stages.
--
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-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(cli): sort jobs by stage completion ratio [datafusion-ballista]
Posted by "QuakeWang (via GitHub)" <gi...@apache.org>.
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(cli): sort jobs by stage completion ratio [datafusion-ballista]
Posted by "martin-g (via GitHub)" <gi...@apache.org>.
martin-g commented on PR #1947:
URL: https://github.com/apache/datafusion-ballista/pull/1947#issuecomment-5130931680
Thank you, @QuakeWang !
--
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-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(cli): sort jobs by stage completion ratio [datafusion-ballista]
Posted by "coderfender (via GitHub)" <gi...@apache.org>.
coderfender commented on code in PR #1947:
URL: https://github.com/apache/datafusion-ballista/pull/1947#discussion_r3524364661
##########
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:
Nit : Perhaps 128bit int is an overkill here ?
--
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-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(cli): sort jobs by stage completion ratio [datafusion-ballista]
Posted by "martin-g (via GitHub)" <gi...@apache.org>.
martin-g merged PR #1947:
URL: https://github.com/apache/datafusion-ballista/pull/1947
--
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-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org