Skip to content

Commit 2e55cc9

Browse files
authored
Merge pull request #225 from meijing123/#224
[#224] fix: addressing Negative Values Arising from Wasted CPU Comput…
2 parents 5922103 + 11cc79a commit 2e55cc9

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

task-parser/src/main/java/com/oppo/cloud/parser/utils/ReplaySparkEventLogs.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,22 @@ private void parseLine(String line) throws Exception {
112112
case "SparkListenerApplicationStart":
113113
SparkListenerApplicationStart sparkListenerApplicationStart = objectMapper.readValue(line,
114114
SparkListenerApplicationStart.class);
115-
this.application.setAppStartTimestamp(sparkListenerApplicationStart.getTime());
115+
Long appStartTimestamp = this.application.getAppStartTimestamp();
116+
if (appStartTimestamp != null && appStartTimestamp < sparkListenerApplicationStart.getTime()) {
117+
this.application.setAppStartTimestamp(appStartTimestamp);
118+
}else {
119+
this.application.setAppStartTimestamp(sparkListenerApplicationStart.getTime());
120+
}
116121
break;
117122
case "SparkListenerApplicationEnd":
118123
SparkListenerApplicationEnd sparkListenerApplicationEnd = objectMapper.readValue(line,
119124
SparkListenerApplicationEnd.class);
120-
this.application.setAppEndTimestamp(sparkListenerApplicationEnd.getTime());
125+
Long appEndTimestamp = this.application.getAppEndTimestamp();
126+
if (appEndTimestamp != null && appEndTimestamp > sparkListenerApplicationEnd.getTime()){
127+
this.application.setAppEndTimestamp(appEndTimestamp);
128+
}else {
129+
this.application.setAppEndTimestamp(sparkListenerApplicationEnd.getTime());
130+
}
121131
break;
122132
case "SparkListenerBlockManagerAdded":
123133
SparkListenerBlockManagerAdded sparkListenerBlockManagerAdded = objectMapper.readValue(line,

0 commit comments

Comments
 (0)