GitHub user davies opened a pull request:
https://github.com/apache/spark/pull/13204
explain of whole stage codegen
## What changes were proposed in this pull request?
Currently, the explain of a query with whole-stage codegen looks like this
```
>>> df = sqlCtx.range(1000);df2 =
sqlCtx.range(1000);df.join(pyspark.sql.functions.broadcast(df2), 'id').explain()
== Physical Plan ==
WholeStageCodegen
: +- Project [id#1L]
: +- BroadcastHashJoin [id#1L], [id#4L], Inner, BuildRight, None
: :- Range 0, 1, 4, 1000, [id#1L]
: +- INPUT
+- BroadcastExchange HashedRelationBroadcastMode(List(input[0, bigint]))
+- WholeStageCodegen
: +- Range 0, 1, 4, 1000, [id#4L]
```
The problem is that the plan looks much different than logical plan, make
us hard to understand the plan (especially when the logical plan is not showed
together).
This PR will change it to:
```
>>> df = sqlCtx.range(1000);df2 =
sqlCtx.range(1000);df.join(pyspark.sql.functions.broadcast(df2), 'id').explain()
== Physical Plan ==
WholeStageCodegen
+- Project [id#0L]
+- BroadcastHashJoin [id#0L], [id#3L], Inner, BuildRight, None
:- Range 0, 1, 4, 1000, [id#0L]
+- CodegenInput
+- BroadcastExchange HashedRelationBroadcastMode(List(input[0,
bigint, false]))
+- WholeStageCodegen
+- Range 0, 1, 4, 1000, [id#3L]
```
This one is easier to understand the plan, but a little bit harder to find
out which parts will be codegen together, we need to find all the operators
between WholeStageCodegen and CodegenInput. Hopefully we do need to pay much
attention on this, it's probably OK.
## How was this patch tested?
Manually ran some queries and check the explain.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/davies/spark explain_codegen
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/13204.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #13204
----
commit db5ad6211da458bed0ac66f9c93d87ae5b87ef16
Author: Davies Liu <[email protected]>
Date: 2016-05-19T21:57:29Z
explain of whole stage codegen
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]