erenavsarogullari commented on a change in pull request #28208:
URL: https://github.com/apache/spark/pull/28208#discussion_r426324660



##########
File path: 
sql/core/src/main/scala/org/apache/spark/status/api/v1/sql/SqlResource.scala
##########
@@ -84,18 +130,52 @@ private[v1] class SqlResource extends BaseAppResource {
     }
 
     val duration = exec.completionTime.getOrElse(new Date()).getTime - 
exec.submissionTime
-    val planDetails = if (details) exec.physicalPlanDescription else ""
-    val metrics = if (details) printableMetrics(exec.metrics, 
exec.metricValues) else Seq.empty
+    val planDetails = if (planDescription) exec.physicalPlanDescription else ""
+    val nodes =
+      if (details) {
+        printableMetrics(
+          sparkPlanGraphNodes, exec.metricValues, nodeIdAndWSCGIdMap)
+      } else {
+        Seq.empty
+      }
+    val edges = if (details) sparkPlanGraphEdges else Seq.empty
+
     new ExecutionData(
       exec.executionId,
       status,
       exec.description,
       planDetails,
-      metrics,
       new Date(exec.submissionTime),
       duration,
       running,
       completed,
-      failed)
+      failed,
+      nodes,
+      edges)
   }
+
+  private def printableMetrics(sparkPlanGraphNodes: Seq[SparkPlanGraphNode],
+    metricValues: Map[Long, String],
+    nodeIdAndWSCGIdMap: Map[Long, Option[Long]]): Seq[Node] = {
+
+    def getMetric(metricValues: Map[Long, String], accumulatorId: Long,
+      metricName: String): Option[Metric] = {
+
+      metricValues.get(accumulatorId).map( mv => {
+        val metricValue = if (mv.startsWith("\n")) mv.substring(1, mv.length) 
else mv
+        Metric(metricName, metricValue)

Review comment:
       Yes, sounds good.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to