-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-12094][SQL] Prettier tree string for TreeNode #10099
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
For example, the following snippet val path = "file:///tmp/parquet/unsafe"
(sqlContext range 10 coalesce 1).write mode "overwrite" parquet path
sqlContext.read parquet path registerTempTable "u"
sqlContext.sql(
"""SELECT COUNT(*)
|FROM (
| SELECT x.id FROM u x JOIN u y ON x.id = y.id
|) a
|JOIN (
| SELECT * FROM u WHERE id < 7
|) b
|WHERE a.id = b.id
""".stripMargin
) explain truegives the following query plan explanation, which can be (arguably) more intuitive: The reason why " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this may be arguably more readable:
lastChildren.init.map { isLast =>
if (isLast) " " else ": "
}.mkString + (if (lastChildren.last) "+- " else ":- ")
|
This is pretty cool, thanks! LGTM |
|
@cloud-fan Thanks! Comments addressed. |
|
Test build #47053 has finished for PR 10099 at commit
|
10eb09e to
31a1c22
Compare
|
Test build #47062 has finished for PR 10099 at commit
|
|
Test build #47063 has finished for PR 10099 at commit
|
|
Merging to master and branch 1.6. |
When examining plans of complex queries with multiple joins, a pain point of mine is that, it's hard to immediately see the sibling node of a specific query plan node. This PR adds tree lines for the tree string of a `TreeNode`, so that the result can be visually more intuitive. Author: Cheng Lian <[email protected]> Closes #10099 from liancheng/prettier-tree-string. (cherry picked from commit a1542ce) Signed-off-by: Yin Huai <[email protected]>
When examining plans of complex queries with multiple joins, a pain point of mine is that, it's hard to immediately see the sibling node of a specific query plan node. This PR adds tree lines for the tree string of a
TreeNode, so that the result can be visually more intuitive.