Skip to content

Conversation

@wanweitao
Copy link
Contributor

@wanweitao wanweitao commented Oct 22, 2025

Description

  • Variable names in task stats are updated in recent changes. Update ui code to ensure correct data on the Timeline page.
  • Fixed the operator filter in the Stage Detail view, which previously showed stats for all operators instead of the selected one.

Motivation and Context

N/A

Impact

Timeline
Before After
before after
Stage Detail
Before After
stage_before stage_after

Note: Number and figure of tasks are correct (1) after this fix.

Test Plan

N/A

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.
  • If adding new dependencies, verified they have an OpenSSF Scorecard score of 5.0 or higher (or obtained explicit TSC approval for lower scores).

Release Notes

== NO RELEASE NOTE ==

@wanweitao wanweitao requested review from a team and yhwang as code owners October 22, 2025 16:25
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 22, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Aligns UI data mappings with updated task stats time properties and corrects operator filtering in the Stage Detail view by eliminating variable shadowing.

Class diagram for updated task stats time properties in SplitView and Splits

classDiagram
class TaskStats {
  +createTimeInMillis
  +firstStartTimeInMillis
  +lastStartTimeInMillis
  +lastEndTimeInMillis
  +endTimeInMillis
}
class SplitView {
  +data
  +show
}
class Splits {
}
SplitView --> TaskStats : uses
Splits --> TaskStats : uses
Loading

Class diagram for corrected operator filtering in Stage Detail view

classDiagram
class OperatorDetail {
  +index
  +operator
  +tasks
  +operatorTasks
}
class Pipeline {
  +pipelineId
  +operatorSummaries
}
class OperatorSummary {
  +operatorId
}
OperatorDetail --> Pipeline : iterates
Pipeline --> OperatorSummary : contains
OperatorDetail --> OperatorSummary : filters
Loading

File-Level Changes

Change Details Files
Use new '*InMillis' fields for time mappings in task stats
  • Replaced createTime with createTimeInMillis
  • Replaced firstStartTime with firstStartTimeInMillis
  • Replaced lastStartTime with lastStartTimeInMillis
  • Replaced lastEndTime with lastEndTimeInMillis
  • Replaced endTime with endTimeInMillis
presto-ui/src/components/QuerySplitsView.jsx
presto-ui/src/components/Splits.jsx
Fix operator summary filtering by avoiding variable shadowing
  • Renamed callback parameter from operator to op in pipeline.operatorSummaries
  • Adjusted ID comparison to use op.operatorId
  • Pushed op to operatorTasks instead of the shadowed operator variable
presto-ui/src/components/QueryStageView.jsx
presto-ui/src/components/StageDetail.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:

  • Extract the repeated time mapping logic in QuerySplitsView and Splits into a shared utility to reduce duplication.
  • Instead of using the generic name 'op' for the operator summary loop, consider a more descriptive name like 'operatorSummary' for clarity.
  • Review other components for similar variable shadowing patterns to ensure consistent naming conventions across the codebase.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Extract the repeated time mapping logic in QuerySplitsView and Splits into a shared utility to reduce duplication.
- Instead of using the generic name 'op' for the operator summary loop, consider a more descriptive name like 'operatorSummary' for clarity.
- Review other components for similar variable shadowing patterns to ensure consistent naming conventions across the codebase.

## Individual Comments

### Comment 1
<location> `presto-ui/src/components/QueryStageView.jsx:190-191` </location>
<code_context>
         tasksSorted.forEach(task => {
             task.stats.pipelines.forEach(pipeline => {
                 if (pipeline.pipelineId === operator.pipelineId) {
-                    pipeline.operatorSummaries.forEach(operator => {
-                        if (operator.operatorId === operator.operatorId) {
-                            operatorTasks.push(operator);
+                    pipeline.operatorSummaries.forEach(op => {
</code_context>

<issue_to_address>
**issue (bug_risk):** The previous comparison always evaluated to true, masking potential logic errors.

The previous comparison checked operator.operatorId against itself, which would always succeed. The revised comparison correctly checks op.operatorId against operator.operatorId, addressing the logic error.
</issue_to_address>

### Comment 2
<location> `presto-ui/src/components/StageDetail.jsx:192-193` </location>
<code_context>
         tasksSorted.forEach(task => {
             task.stats.pipelines.forEach(pipeline => {
                 if (pipeline.pipelineId === operator.pipelineId) {
-                    pipeline.operatorSummaries.forEach(operator => {
-                        if (operator.operatorId === operator.operatorId) {
-                            operatorTasks.push(operator);
+                    pipeline.operatorSummaries.forEach(op => {
</code_context>

<issue_to_address>
**issue (bug_risk):** The previous self-comparison always returned true, which could lead to incorrect data aggregation.

Comparing op.operatorId with operator.operatorId now ensures only matching operator summaries are included in the aggregation.
</issue_to_address>

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.

@tdcmeehan tdcmeehan requested a review from unidevel October 22, 2025 16:31
@wanweitao wanweitao changed the title fix(ui): fix timeline and stage detail fix(ui): Fix timeline and stage detail Oct 22, 2025
@wanweitao wanweitao force-pushed the wanweitao/fix-presto-ui branch from b3a0ebd to c4beb9a Compare October 22, 2025 17:17
@yhwang
Copy link
Member

yhwang commented Oct 22, 2025

Hi @wanweitao thanks for the fix and update. Could you also check QueryDetail.jsx and QueryOverview.jsx? I saw the usage of stats.createTime there. Thanks!

@wanweitao wanweitao force-pushed the wanweitao/fix-presto-ui branch from c4beb9a to 584876f Compare October 23, 2025 01:27
@wanweitao
Copy link
Contributor Author

wanweitao commented Oct 23, 2025

Hi @wanweitao thanks for the fix and update. Could you also check QueryDetail.jsx and QueryOverview.jsx? I saw the usage of stats.createTime there. Thanks!

Thanks for pointing that out. The stats.createTime in QueryDetail.jsx and QueryOverview.jsx does need to be fixed. I updated the commit.

@wanweitao wanweitao force-pushed the wanweitao/fix-presto-ui branch from 037ec21 to d897e4e Compare October 23, 2025 02:09
@unidevel
Copy link
Contributor

@wanweitao Please check if there any tooltip or label related to the new field xxxTimeInMillis, may need format it before display. Except this, I don't have concerns.

@wanweitao
Copy link
Contributor Author

wanweitao commented Oct 23, 2025

@wanweitao Please check if there any tooltip or label related to the new field xxxTimeInMillis, may need format it before display. Except this, I don't have concerns.

Hi, I just checked. Seems there's no other tooltip or label displaying this field. It's used in two places:

  • As parameter start and end to library vis-timeline, which appears to handle both string and millisecond timestamps correctly
  • In the calculateElapsedTime function, where I removed the unnecessary parsing

Hopefully I didn’t miss any other occurrences.

@wanweitao wanweitao force-pushed the wanweitao/fix-presto-ui branch from d897e4e to 69f367c Compare October 23, 2025 15:44
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.

/LGTM

@yhwang yhwang merged commit 1788628 into prestodb:master Oct 27, 2025
80 of 92 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants