Skip to content

Commit da5ed1c

Browse files
committed
cap duration percentage at 100%
1 parent 9ac99dd commit da5ed1c

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

spark-ui/src/reducers/SQLNodeStageReducer.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
SparkStagesStore,
77
SQLNodeStageData,
88
} from "../interfaces/AppStore";
9+
import { calculatePercentage } from "../utils/FormatUtils";
910
import { generateGraph } from "./PlanGraphUtils";
1011
import { calculateNodeToStorageInfo } from "./SqlReducer";
1112

@@ -320,14 +321,7 @@ export function calculateSqlStage(
320321
: undefined);
321322
const durationPercentage =
322323
duration !== undefined && sql.stageMetrics !== undefined
323-
? sql.stageMetrics?.executorRunTime === 0
324-
? 0
325-
: Math.max(
326-
0,
327-
Math.min(100, duration / sql.stageMetrics?.executorRunTime) *
328-
100,
329-
)
330-
: undefined;
324+
? calculatePercentage(duration, sql.stageMetrics?.executorRunTime) : undefined
331325
return {
332326
...node,
333327
duration: duration,

0 commit comments

Comments
 (0)