cloud-fan commented on issue #24759: [SPARK-27395][SQL][WIP] Improve EXPLAIN 
command
URL: https://github.com/apache/spark/pull/24759#issuecomment-520833907
 
 
   I think we have too many string related methods in `TreeNode`, which makes 
it pretty hard to extend.
   
   Maybe it's time to introduce a new framework for printing a query plan, 
which is decoupled from the query plan itself. For example,
   ```
   class QueryPlanPrinter(plan: QueryPlan[_]) {
     
     def printSimplePlan... {
       case Join => ....
       ....
       case LeafNode =>
       case other => ....
     }
   
     def printVerbosePlan...
   }
   ```
   
   BTW one idea to assign unique operator IDs: use `TreeNodeTag`
   ```
   val tag = TreeNodeTag[Int]("operatorId")
   var id = 0
   plan.foreach {
     case plan =>
       plan.setTag(tag, id)
       id += 1
   }
   ....
   // after everything is done, remove the tag at the end
   ```

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