Skip to content

Conversation

unidevel
Copy link
Contributor

@unidevel unidevel commented Sep 14, 2025

Description

  1. Fix live plan not showing
image
  1. Fix warnings in Query Header

  2. Fix output data size is undefined - due to this change , outputDataSize is changed to outputDataSizeInBytes

Motivation and Context

Impact

UI

Test Plan

Manual test

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

== NO RELEASE NOTE ==

@unidevel unidevel requested review from a team and yhwang as code owners September 14, 2025 16:30
@prestodb-ci prestodb-ci added the from:IBM PR from IBM label Sep 14, 2025
@prestodb-ci prestodb-ci requested review from a team, Dilli-Babu-Godari and namya28 and removed request for a team September 14, 2025 16:30
Copy link
Contributor

sourcery-ai bot commented Sep 14, 2025

Reviewer's Guide

This PR refactors UI components to use the new byte-based data size properties and proper formatting, ensures the LivePlan visualization always updates, and addresses React warning in the query header tabs.

Class diagram for updated data size properties in Operator and Stage statistics

classDiagram
    class Operator {
      +inputDataSizeInBytes
      +outputDataSizeInBytes
      +inputPositions
      +outputPositions
      +Other attributes
    }
    class StageStatistics {
      +bufferedDataSizeInBytes
      +userMemoryReservationInBytes
      +rawInputDataSizeInBytes
      +outputDataSizeInBytes
      +Other attributes
    }
    Operator --> StageStatistics: used in statistics display
Loading

File-Level Changes

Change Details Files
Migrate data size handling to the new *InBytes fields with proper formatting
  • Replaced parseDataSize/operator.outputDataSize with direct use of operator.*InBytes
  • Updated formatDataSize/formatDataSizeBytes for display in summaries and stat panels
  • Renamed OperatorDetail id/supplier for inputDataSizeInBytes and outputDataSizeInBytes
  • Updated plan edge labels in LivePlan and QueryPlanView to use InBytes fields
presto-ui/src/components/StageDetail.jsx
presto-ui/src/components/QueryStageView.jsx
presto-ui/src/components/QueryPlanView.jsx
presto-ui/src/components/LivePlan.jsx
Ensure LivePlan graph always re-renders
  • Removed conditional around updateD3Graph in componentDidUpdate
  • Always invoke updateD3Graph on state/prop changes
presto-ui/src/components/LivePlan.jsx
Fix React fragment key warnings in QueryHeader
  • Wrapped tab elements in React.Fragment with unique key prop
presto-ui/src/components/QueryHeader.jsx

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

  • Consider formatting the raw byte count (outputDataSizeInBytes) into a human-readable string (KB/MB/GB) rather than displaying the raw number to match the rest of the UI.
  • Instead of unconditionally calling updateD3Graph in componentDidUpdate, add a guard to only run it when the underlying plan data actually changes to avoid unnecessary graph re-renders.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider formatting the raw byte count (outputDataSizeInBytes) into a human-readable string (KB/MB/GB) rather than displaying the raw number to match the rest of the UI.
- Instead of unconditionally calling updateD3Graph in componentDidUpdate, add a guard to only run it when the underlying plan data actually changes to avoid unnecessary graph re-renders.

## Individual Comments

### Comment 1
<location> `presto-ui/src/components/LivePlan.jsx:253` </location>
<code_context>
                                 style: "stroke-width: 4px",
                                 arrowheadClass: "plan-arrowhead",
-                                label: sourceStats.outputDataSize + " / " + formatRows(sourceStats.outputPositions),
+                                label: sourceStats.outputDataSizeInBytes + " bytes / " + formatRows(sourceStats.outputPositions),
                                 labelStyle: "color: #fff; font-weight: bold; font-size: 24px;",
                                 labelType: "html",
</code_context>

<issue_to_address>
Consider using a human-readable format for byte size display.

Formatting the byte size as KB, MB, or GB will make the label easier for users to interpret.

Suggested implementation:

```javascript
                                label: formatBytes(sourceStats.outputDataSizeInBytes) + " / " + formatRows(sourceStats.outputPositions),

```

```javascript
    }

    // Utility function to format bytes as human-readable string
    function formatBytes(bytes) {
        if (bytes === 0) return '0 Bytes';
        const k = 1024;
        const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB'];
        const i = Math.floor(Math.log(bytes) / Math.log(k));
        return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
    }

```
</issue_to_address>

### Comment 2
<location> `presto-ui/src/components/QueryHeader.jsx:118` </location>
<code_context>
                     <div className="col-6 d-flex justify-content-end">
                         <nav className="nav nav-tabs">
                             {tabs.map((page, _) => (
-                                <>
+                                <React.Fragment key={page.label}>
                                     <a className={clsx('nav-link', 'navbar-btn', this.isActive(page.path) && 'active')} href={page.path + '?' + queryId} >{page.label}</a>
                                     &nbsp;
</code_context>

<issue_to_address>
Using page.label as a key may cause issues if labels are not unique.

Using non-unique keys can lead to React rendering problems. Please use a unique value like page.path for the key.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
                                <React.Fragment key={page.label}>
=======
                                <React.Fragment key={page.path}>
>>>>>>> REPLACE

</suggested_fix>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@unidevel unidevel force-pushed the uifix branch 3 times, most recently from ad58d76 to fc6432a Compare September 15, 2025 12:27
@unidevel unidevel changed the title [ui] Fix live plan not showing [ui] Fix live plan not showing and output data size is undefined Sep 15, 2025
@tdcmeehan
Copy link
Contributor

Another reason to work on #25744, it would have caught this problem.

style: "stroke-width: 4px",
arrowheadClass: "plan-arrowhead",
label: sourceStats.outputDataSize + " / " + formatRows(sourceStats.outputPositions),
label: sourceStats.outputDataSizeInBytes + " / " + formatRows(sourceStats.outputPositions),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this be less user friendly/readable then previously (e.g. would it previously show 10GB, and now will show 10000000000 bytes)? Can we convert it back to something that will be readable? Same comment for the rest of the usages

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utils.formatDataSizeBytes() could be used here to improve the readability

@rschlussel
Copy link
Contributor

Also,

  1. can you share a picture of what the UI looks like after it's fixed?
  2. Is it possible to add tests for the UI so we can't accidentally completely break important UI features?

@unidevel unidevel marked this pull request as draft September 15, 2025 19:16
@unidevel
Copy link
Contributor Author

Just found there are many other issues about the inputDataSize is renamed to inputDataSizeInBytes, I'll check and fix later

@unidevel unidevel force-pushed the uifix branch 2 times, most recently from d58e73e to 32ee924 Compare September 16, 2025 22:20
@unidevel
Copy link
Contributor Author

unidevel commented Sep 17, 2025

@rschlussel here are the screenshots

Live plan
Before fix After fix
image image
Stage Performance
Before fix After fix
image image
Pipeline details
Before fix After fix
image image

@unidevel unidevel marked this pull request as ready for review September 17, 2025 10:52
@prestodb-ci prestodb-ci requested a review from a team September 17, 2025 10:52
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@unidevel unidevel requested a review from rschlussel September 18, 2025 17:35
@prestodb-ci
Copy link
Contributor

@unidevel imported this issue as lakehouse/presto #26033

@unidevel unidevel changed the title [ui] Fix live plan not showing and output data size is undefined fix: live plan not showing and output data size is undefined Oct 4, 2025
@unidevel unidevel changed the title fix: live plan not showing and output data size is undefined fix: Live plan not showing and output data size is undefined Oct 4, 2025
style: "stroke-width: 4px",
arrowheadClass: "plan-arrowhead",
label: sourceStats.outputDataSize + " / " + formatRows(sourceStats.outputPositions),
label: sourceStats.outputDataSizeInBytes + " / " + formatRows(sourceStats.outputPositions),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to format this part too? just curious

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should match to the LivePlan in LivePlan.jsx

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @yhwang , fixed

@tdcmeehan tdcmeehan self-assigned this Oct 6, 2025
Copy link
Member

@yhwang yhwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the fix!
LGTM

@yhwang
Copy link
Member

yhwang commented Oct 9, 2025

Hi @rschlussel

Is it possible to add tests for the UI so we can't accidentally completely break important UI features?

I think this would be a working item for the UI. We should trace this in another issue and new PR to address it. Are you okay with the this?
If yes and the screenshots look good to you, we can merge this PR.

@tdcmeehan
Copy link
Contributor

The lack of tests are certainly something we should address, but it's a pre-existing issue. This makes the UI usable again, so we should merge this.

@tdcmeehan
Copy link
Contributor

@unidevel we should also make sure this lands in 0.295.

Copy link
Contributor

@rschlussel rschlussel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this!

@unidevel
Copy link
Contributor Author

unidevel commented Oct 9, 2025

@tdcmeehan I added the PR for 0.295 release and did a quick test with this new PR, it looks fine in my local env. => #26264

@yhwang yhwang merged commit 2a5c96d into prestodb:master Oct 9, 2025
76 of 77 checks passed
unidevel added a commit that referenced this pull request Oct 9, 2025
## Description
1. Fix live plan not showing
<img width="2448" height="1730" alt="image"
src="https://github.com/user-attachments/assets/25698228-0d62-4326-b0c7-41c1ed3af579"
/>

2. Fix warnings in Query Header

3. Fix output data size is `undefined` - due to [this
change](7458b52)
, `outputDataSize` is changed to `outputDataSizeInBytes`

## Motivation and Context
PR for master branch: #26033

## Impact
UI

## Test Plan
Manual test

## Contributor checklist

- [ ] Please make sure your submission complies with our [contributing
guide](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md),
in particular [code
style](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#code-style)
and [commit
standards](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#commit-standards).
- [ ] PR description addresses the issue accurately and concisely. If
the change is non-trivial, a GitHub Issue is referenced.
- [ ] Documented new properties (with its default value), SQL syntax,
functions, or other functionality.
- [ ] If release notes are required, they follow the [release notes
guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines).
- [ ] Adequate tests were added if applicable.
- [ ] CI passed.

## Release Notes

```
== NO RELEASE NOTE ==
```

---------

Co-authored-by: Timothy Meehan <tim@timdmeehan.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

from:IBM PR from IBM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants