parthchandra commented on code in PR #2412:
URL: https://github.com/apache/datafusion-comet/pull/2412#discussion_r2389617165


##########
spark/src/main/scala/org/apache/comet/ExtendedExplainInfo.scala:
##########
@@ -82,9 +83,29 @@ class ExtendedExplainInfo extends ExtendedExplainGenerator {
   // generates the extended info in a verbose manner, printing each node along 
with the
   // extended information in a tree display
   def generateVerboseExtendedInfo(plan: SparkPlan): String = {
+    val planStats = new CometCoverageStats()
     val outString = new StringBuilder()
-    generateTreeString(getActualPlan(plan), 0, Seq(), 0, outString)
-    outString.toString()
+    generateTreeString(getActualPlan(plan), 0, Seq(), 0, outString, planStats)
+    val eligible = planStats.sparkOperators + planStats.cometOperators
+    val converted =
+      if (eligible == 0) 0.0 else planStats.cometOperators.toDouble / eligible 
* 100.0
+    val summary = s"Comet accelerated ${planStats.cometOperators} out of 
$eligible " +
+      s"eligible operators (${converted.toInt}%). " +
+      s"Final plan contains ${planStats.transitions} transitions."
+    s"${outString.toString()}\n$summary"
+  }
+
+  /** Get the coverage statistics without the full plan */
+  def generateCoverageInfo(plan: SparkPlan): String = {
+    val planStats = new CometCoverageStats()
+    val outString = new StringBuilder()
+    generateTreeString(getActualPlan(plan), 0, Seq(), 0, outString, planStats)
+    val eligible = planStats.sparkOperators + planStats.cometOperators
+    val converted =
+      if (eligible == 0) 0.0 else planStats.cometOperators.toDouble / eligible 
* 100.0
+    s"Comet accelerated ${planStats.cometOperators} out of $eligible " +
+      s"eligible operators (${converted.toInt}%). " +
+      s"Final plan contains ${planStats.transitions} transitions."

Review Comment:
   ```suggestion
         s"Final plan contains ${planStats.transitions} transitions between 
Spark and Comet."
   ```



-- 
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.

To unsubscribe, e-mail: [email protected]

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