dilipbiswal commented on issue #24759: [SPARK-27395][SQL][WIP] Improve EXPLAIN 
command
URL: https://github.com/apache/spark/pull/24759#issuecomment-521864064
 
 
   @maropu 
   > sorry for cutting in, but I like the idea; if we had a 
visiter-pattern-like logic for pringing plans (I think this can be similar to 
LogicalPlanVisitor), we could easily implement another custom format for 
printing plans in future. (since the current logic in master is hard-coded, I 
think its hard to do so though...
   
   Could you please explain your idea a bit more ? Let me outline how things 
are done currently and then perhaps we can discuss how we want to improve.  Let 
me describe how things work now.
   
   1. We have a infrastructure that prints the plan in a tree form. The method 
that does that is `generateTreeString` in TreeNode. This is s recursive method 
that calls helper methods like `simpleString` or `verboseString` on the current 
node (its working on) and deals with spacing 
    of a child below a parent etc.
   2. In this PR, we introduced a new format in which we have two requirement. 
       2.1 We do want the basic tree structure while printing. Only thing is, 
we want slightly different content in each line. (this is why we needed a new 
string method)
       2.2 We need a additional footer section, where we want to print detailed 
node info.
   3. In order to fulfill 2, i introduced a `processPlan` function in 
ExplainUtils, that deals with this
       new format but utilizing the existing infrastructure that deals with 
printing the plan in the
       tree structure and also handles 2.2 to print the footer info. 
   4. Lets say, we want to introduce a new format in the future. I would 
imagine, we would require another method in ExplainUtils  say `processPlan2` 
that can do whatever it wants. For example, `processPlan2` could decide to 
print the plan in JSON.
   
   Now could you please explain your idea w.r.t the current processing ? In my 
thinking, the current infrastructure is extendable and that is the reason we 
could come up with a newer format (header-footer) by making very small change 
to the infrastructure.
    

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to