Skip to content

Commit 1788628

Browse files
authored
fix(ui): Fix timeline and stage detail (#26402)
## Description <!---Describe your changes in detail--> + 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 <!---Why is this change required? What problem does it solve?--> <!---If it fixes an open issue, please link to the issue here.--> N/A ## Impact <!---Describe any public API or user-facing feature change or any performance impact--> <details> <summary>Timeline</summary> | Before | After | |--------|--------| | <img width="1194" height="876" alt="before" src="https://github.com/user-attachments/assets/af29e66f-b817-4a92-a196-fad9c095a359" /> | <img width="1200" height="934" alt="after" src="https://github.com/user-attachments/assets/e1471585-7502-4555-96f5-98f9406cdd7e" />| </details> <details> <summary>Stage Detail</summary> | Before | After | |--------|--------| |<img width="1197" height="781" alt="stage_before" src="https://github.com/user-attachments/assets/2a00af6c-66f1-43c9-8535-f3e83f476b3d" />|<img width="1177" height="748" alt="stage_after" src="https://github.com/user-attachments/assets/45a7477a-8b9a-4d5b-8642-dca46a4bc1ab" />| Note: Number and figure of tasks are correct (1) after this fix. </details> ## Test Plan <!---Please fill in how you tested your change--> N/A ## Contributor checklist - [x] 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). - [x] PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced. - [x] Documented new properties (with its default value), SQL syntax, functions, or other functionality. - [x] If release notes are required, they follow the [release notes guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines). - [x] Adequate tests were added if applicable. - [x] CI passed. - [x] If adding new dependencies, verified they have an [OpenSSF Scorecard](https://securityscorecards.dev/#the-checks) score of 5.0 or higher (or obtained explicit TSC approval for lower scores). ## Release Notes ``` == NO RELEASE NOTE == ```
1 parent 354183b commit 1788628

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

presto-ui/src/components/QueryDetail.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ function TaskList({tasks}) {
109109
function calculateElapsedTime(row) {
110110
let elapsedTime = parseDuration(row.stats.elapsedTimeInNanos + "ns");
111111
if (elapsedTime === 0) {
112-
elapsedTime = Date.now() - Date.parse(row.stats.createTime);
112+
elapsedTime = Date.now() - row.stats.createTimeInMillis;
113113
}
114114
return elapsedTime;
115115
}

presto-ui/src/components/QueryOverview.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ type TaskStatus = {
4949
}
5050

5151
type TaskStats = {
52-
createTime: string;
52+
createTimeInMillis: number;
5353
elapsedTimeInNanos: number;
5454
totalCpuTimeInNanos: number;
5555
fullyBlocked: boolean;
@@ -285,7 +285,7 @@ function TaskList({ tasks }: { tasks: Task[] }) : React.Node {
285285
function calculateElapsedTime(row: Task): number {
286286
let elapsedTime = parseDuration(row.stats.elapsedTimeInNanos + "ns") || 0;
287287
if (elapsedTime === 0) {
288-
elapsedTime = Date.now() - Date.parse(row.stats.createTime);
288+
elapsedTime = Date.now() - row.stats.createTimeInMillis;
289289
}
290290
return elapsedTime;
291291
}

presto-ui/src/components/QuerySplitsView.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ export default function SplitView({ data, show }): void {
3232
return {
3333
taskId: task.taskId.substring(task.taskId.indexOf('.') + 1),
3434
time: {
35-
create: task.stats.createTime,
36-
firstStart: task.stats.firstStartTime,
37-
lastStart: task.stats.lastStartTime,
38-
lastEnd: task.stats.lastEndTime,
39-
end: task.stats.endTime,
35+
create: task.stats.createTimeInMillis,
36+
firstStart: task.stats.firstStartTimeInMillis,
37+
lastStart: task.stats.lastStartTimeInMillis,
38+
lastEnd: task.stats.lastEndTimeInMillis,
39+
end: task.stats.endTimeInMillis,
4040
},
4141
};
4242
});

presto-ui/src/components/QueryStageView.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@ function OperatorDetail({ index, operator, tasks }) {
187187
tasksSorted.forEach(task => {
188188
task.stats.pipelines.forEach(pipeline => {
189189
if (pipeline.pipelineId === operator.pipelineId) {
190-
pipeline.operatorSummaries.forEach(operator => {
191-
if (operator.operatorId === operator.operatorId) {
192-
operatorTasks.push(operator);
190+
pipeline.operatorSummaries.forEach(op => {
191+
if (op.operatorId === operator.operatorId) {
192+
operatorTasks.push(op);
193193
}
194194
});
195195
}

presto-ui/src/components/Splits.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ export default function Split(): void {
3636
return {
3737
taskId: task.taskId.substring(task.taskId.indexOf('.') + 1),
3838
time: {
39-
create: task.stats.createTime,
40-
firstStart: task.stats.firstStartTime,
41-
lastStart: task.stats.lastStartTime,
42-
lastEnd: task.stats.lastEndTime,
43-
end: task.stats.endTime,
39+
create: task.stats.createTimeInMillis,
40+
firstStart: task.stats.firstStartTimeInMillis,
41+
lastStart: task.stats.lastStartTimeInMillis,
42+
lastEnd: task.stats.lastEndTimeInMillis,
43+
end: task.stats.endTimeInMillis,
4444
},
4545
};
4646
});

presto-ui/src/components/StageDetail.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,9 @@ function OperatorDetail({ index, operator, tasks }) {
189189
tasksSorted.forEach(task => {
190190
task.stats.pipelines.forEach(pipeline => {
191191
if (pipeline.pipelineId === operator.pipelineId) {
192-
pipeline.operatorSummaries.forEach(operator => {
193-
if (operator.operatorId === operator.operatorId) {
194-
operatorTasks.push(operator);
192+
pipeline.operatorSummaries.forEach(op => {
193+
if (op.operatorId === operator.operatorId) {
194+
operatorTasks.push(op);
195195
}
196196
});
197197
}

0 commit comments

Comments
 (0)