GitHub user gatorsmile opened a pull request:
https://github.com/apache/spark/pull/10393
[SPARK-12441] [SQL] Fixing missingInput in Generate
When explain any plan with Generate, we will see an exclamation mark in the
plan. Normally, when we see this mark, it means the plan has an error. This PR
is to correct the `missingInput` in `Generate`.
For example,
```scala
val df = Seq((1, "a b c"), (2, "a b"), (3, "a")).toDF("number", "letters")
val df2 =
df.explode('letters) {
case Row(letters: String) => letters.split(" ").map(Tuple1(_)).toSeq
}
df2.explain(true)
```
Before the fix, the plan is like
```
== Parsed Logical Plan ==
'Generate UserDefinedGenerator('letters), true, false, None
+- Project [_1#0 AS number#2,_2#1 AS letters#3]
+- LocalRelation [_1#0,_2#1], [[1,a b c],[2,a b],[3,a]]
== Analyzed Logical Plan ==
number: int, letters: string, _1: string
Generate UserDefinedGenerator(letters#3), true, false, None, [_1#8]
+- Project [_1#0 AS number#2,_2#1 AS letters#3]
+- LocalRelation [_1#0,_2#1], [[1,a b c],[2,a b],[3,a]]
== Optimized Logical Plan ==
Generate UserDefinedGenerator(letters#3), true, false, None, [_1#8]
+- LocalRelation [number#2,letters#3], [[1,a b c],[2,a b],[3,a]]
== Physical Plan ==
!Generate UserDefinedGenerator(letters#3), true, false,
[number#2,letters#3,_1#8]
+- LocalTableScan [number#2,letters#3], [[1,a b c],[2,a b],[3,a]]
```
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/gatorsmile/spark generateExplain
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/10393.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 #10393
----
commit 21071d1bc9fe0d5869fa94f21f617ee5dbaae390
Author: gatorsmile <[email protected]>
Date: 2015-12-19T18:33:59Z
correct missingInput.
----
---
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]