dilipbiswal commented on a change in pull request #24759: [SPARK-27395][SQL] 
Improve EXPLAIN command
URL: https://github.com/apache/spark/pull/24759#discussion_r316454665
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/basicPhysicalOperators.scala
 ##########
 @@ -682,6 +699,28 @@ abstract class BaseSubqueryExec extends SparkPlan {
   override def outputPartitioning: Partitioning = child.outputPartitioning
 
   override def outputOrdering: Seq[SortOrder] = child.outputOrdering
+
+  override def generateTreeString(
+      depth: Int,
+      lastChildren: Seq[Boolean],
+      append: String => Unit,
+      verbose: Boolean,
+      prefix: String = "",
+      addSuffix: Boolean = false,
+      maxFields: Int,
+      printNodeId: Boolean): Unit = {
+    if (!printNodeId) {
 
 Review comment:
   @cloud-fan Oh.. because we don't show these SubqueryExec ops in the new 
format. Here is an example:
   ** SQL **
   ```
   explain select * from explain_temp1 where key = (select max(key) from 
explain_temp2);
   ```
   ** Old output **
   ```
   == Physical Plan ==
   *(1) Project [key#33776, val#33777]
   +- *(1) Filter (isnotnull(key#33776) AND (key#33776 = Subquery 
scalar-subquery#33790))
      :  +- Subquery scalar-subquery#33790
      :     +- *(2) HashAggregate(keys=[], functions=[max(key#33778)])
      :        +- Exchange SinglePartition, true
      :           +- *(1) HashAggregate(keys=[], 
functions=[partial_max(key#33778)])
      :              +- *(1) ColumnarToRow
      :                 +- FileScan parquet default.explain_temp2[key#33778] 
Batched: true, DataFilters: [], Format: Parquet, Location: 
InMemoryFileIndex[file:/user/hive/warehouse/explain_temp2], PartitionFilters: 
[], PushedFilters: [], ReadSchema: struct<key:int>
      +- *(1) ColumnarToRow
         +- FileScan parquet default.explain_temp1[key#33776,val#33777] 
Batched: true, DataFilters: [isnotnull(key#33776)], Format: Parquet, Location: 
InMemoryFileIndex[file:/user/hive/warehouse/explain_temp1], PartitionFilters: 
[], PushedFilters: [IsNotNull(key)], ReadSchema: struct<key:int,val:int>
   
   ```
   The line  `Subquery scalar-subquery#33790` does not show up in the new plan 
as we only show the actual plan and not the containing operator.

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


With regards,
Apache Git Services

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

Reply via email to