From 3573d3ebc323b4f395700fdc37e4734ae2e91e8a Mon Sep 17 00:00:00 2001 From: Niranjan Artal Date: Thu, 2 Nov 2023 17:16:56 -0700 Subject: [PATCH] optimize checks Signed-off-by: Niranjan Artal --- .../rapids/tool/qualification/QualificationAppInfo.scala | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/src/main/scala/org/apache/spark/sql/rapids/tool/qualification/QualificationAppInfo.scala b/core/src/main/scala/org/apache/spark/sql/rapids/tool/qualification/QualificationAppInfo.scala index 33cc5c23c..170c5823f 100644 --- a/core/src/main/scala/org/apache/spark/sql/rapids/tool/qualification/QualificationAppInfo.scala +++ b/core/src/main/scala/org/apache/spark/sql/rapids/tool/qualification/QualificationAppInfo.scala @@ -201,12 +201,12 @@ class QualificationAppInfo( private def checkStageIdInExec(prev: Option[ExecInfo], execInfo: ExecInfo, next: Option[ExecInfo]): (Seq[(Int, ExecInfo)], Option[ExecInfo]) = { val associatedStages = { - if (execInfo.stages.size >= 1) { + if (execInfo.stages.nonEmpty) { execInfo.stages.toSeq } else { - if (prev.exists(_.stages.size >= 1)) { + if (prev.exists(_.stages.nonEmpty)) { prev.flatMap(_.stages.headOption).toSeq - } else if (next.nonEmpty) { + } else if (next.exists(_.stages.nonEmpty)) { next.flatMap(_.stages.headOption).toSeq } else { // we don't know what stage its in or its duration @@ -223,7 +223,6 @@ class QualificationAppInfo( } } - private def getStageToExec(execInfos: Seq[ExecInfo]): (Map[Int, Seq[ExecInfo]], Seq[ExecInfo]) = { val execsWithoutStages = new ArrayBuffer[ExecInfo]()