GitHub user cloud-fan opened a pull request:
https://github.com/apache/spark/pull/16100
[SPARK-18674][SQL] improve the error message of natural join
## What changes were proposed in this pull request?
The current error message of USING join is quite confusing, for example:
```
scala> val df1 = List(1,2,3).toDS.withColumnRenamed("value", "c1")
df1: org.apache.spark.sql.DataFrame = [c1: int]
scala> val df2 = List(1,2,3).toDS.withColumnRenamed("value", "c2")
df2: org.apache.spark.sql.DataFrame = [c2: int]
scala> df1.join(df2, usingColumn = "c1")
org.apache.spark.sql.AnalysisException: using columns ['c1] can not be
resolved given input columns: [c1, c2] ;;
'Join UsingJoin(Inner,List('c1))
:- Project [value#1 AS c1#3]
: +- LocalRelation [value#1]
+- Project [value#7 AS c2#9]
+- LocalRelation [value#7]
```
after this PR, it becomes:
```
scala> val df1 = List(1,2,3).toDS.withColumnRenamed("value", "c1")
df1: org.apache.spark.sql.DataFrame = [c1: int]
scala> val df2 = List(1,2,3).toDS.withColumnRenamed("value", "c2")
df2: org.apache.spark.sql.DataFrame = [c2: int]
scala> df1.join(df2, usingColumn = "c1")
org.apache.spark.sql.AnalysisException: USING column `c1` can not be
resolved with the right join side, the right output is: [c2];
```
## How was this patch tested?
updated tests
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/cloud-fan/spark natural
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/16100.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 #16100
----
commit 94618392045e86498902cb779b07fe88cf10e6de
Author: Wenchen Fan <[email protected]>
Date: 2016-12-01T14:21:39Z
improve the error message of natural join
----
---
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]