Skip to content

Commit

Permalink
Profiling tool throws NPE when appInfo is null and unchecked
Browse files Browse the repository at this point in the history
Signed-off-by: Kuhu Shukla <[email protected]>
  • Loading branch information
kuhushukla committed Oct 27, 2023
1 parent 0163eb8 commit 60f48c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,9 @@ class Analysis(apps: Seq[ApplicationInfo]) {
val allRows = apps.flatMap { app =>
app.sqlIdToInfo.map { case (sqlId, sqlCase) =>
SQLDurationExecutorTimeProfileResult(app.index, app.appId, sqlId, sqlCase.duration,
sqlCase.hasDatasetOrRDD, app.appInfo.duration, sqlCase.problematic,
sqlCase.hasDatasetOrRDD,
if (app.appInfo != null) app.appInfo.duration else Option(0L),
sqlCase.problematic,
sqlCase.sqlCpuTimePercent)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,25 @@ case class StageMetrics(numTasks: Int, duration: String)
class CollectInformation(apps: Seq[ApplicationInfo]) extends Logging {

def getAppInfo: Seq[AppInfoProfileResults] = {
val allRows = apps.map { app =>
val allRows = apps.filterNot(_.appInfo == null).map { app =>
val a = app.appInfo
AppInfoProfileResults(app.index, a.appName, a.appId,
a.sparkUser, a.startTime, a.endTime, a.duration,
a.durationStr, a.sparkVersion, a.pluginEnabled)
}
if (allRows.size > 0) {
if (allRows.nonEmpty) {
allRows.sortBy(cols => (cols.appIndex))
} else {
Seq.empty
}
}

def getAppLogPath: Seq[AppLogPathProfileResults] = {
val allRows = apps.map { app =>
val allRows = apps.filterNot(_.appInfo == null).map { app =>
val a = app.appInfo
AppLogPathProfileResults(app.index, a.appName, a.appId, app.eventLogPath)
}
if (allRows.size > 0) {
if (allRows.nonEmpty) {
allRows.sortBy(cols => (cols.appIndex))
} else {
Seq.empty
Expand Down

0 comments on commit 60f48c5

Please sign in to comment.