GitHub user dilipbiswal opened a pull request:
https://github.com/apache/spark/pull/11497
[SPARK-13651] Generator outputs are not resolved correctly resulting in run
time error
## What changes were proposed in this pull request?
```
Seq(("id1", "value1")).toDF("key", "value").registerTempTable("src")
sqlContext.sql("SELECT t1.* FROM src LATERAL VIEW explode(map('key1', 100,
'key2', 200)) t1 AS key, value")
```
Results in following logical plan
```
Project [key#2,value#3]
+- Generate
explode(HiveGenericUDF#org.apache.hadoop.hive.ql.udf.generic.GenericUDFMap(key1,100,key2,200)),
true, false, Some(genoutput), [key#2,value#3]
+- SubqueryAlias src
+- Project [_1#0 AS key#2,_2#1 AS value#3]
+- LocalRelation [_1#0,_2#1], [[id1,value1]]
```
In this case the generated outputs are wrongly resolved from its child
(LocalRelation) due to
https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala#L537-L548
## How was this patch tested?
(Please explain how this patch was tested. E.g. unit tests, integration
tests, manual tests)
Added unit tests in hive/SQLQuerySuite and AnalysisSuite
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/dilipbiswal/spark spark-13651
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/11497.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 #11497
----
commit cd57079a263309855df7dd70c2d30aa2eee2adbe
Author: Dilip Biswal <[email protected]>
Date: 2016-03-03T08:43:49Z
[SPARK-13651] Generator outputs are not resolved correctly resulting in
runtime error
----
---
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]