diff options
author | Dongjoon Hyun <dongjoon@apache.org> | 2016-08-01 11:12:58 +0200 |
---|---|---|
committer | Herman van Hovell <hvanhovell@databricks.com> | 2016-08-01 11:12:58 +0200 |
commit | 64d8f37c717cbc9c1c3649cae4c7cc4e628cd72d (patch) | |
tree | ed7205b0889da4d51d7478d28cedc2beef17455c /tools | |
parent | 579fbcf3bd9717003025caecc0c0b85bcff7ac7f (diff) | |
download | spark-64d8f37c717cbc9c1c3649cae4c7cc4e628cd72d.tar.gz spark-64d8f37c717cbc9c1c3649cae4c7cc4e628cd72d.tar.bz2 spark-64d8f37c717cbc9c1c3649cae4c7cc4e628cd72d.zip |
[SPARK-16726][SQL] Improve `Union/Intersect/Except` error messages on incompatible types
## What changes were proposed in this pull request?
Currently, `UNION` queries on incompatible types show misleading error messages, i.e., `unresolved operator Union`. We had better show a more correct message. This will help users in the situation of [SPARK-16704](https://issues.apache.org/jira/browse/SPARK-16704).
**Before**
```scala
scala> sql("select 1,2,3 union (select 1,array(2),3)")
org.apache.spark.sql.AnalysisException: unresolved operator 'Union;
scala> sql("select 1,2,3 intersect (select 1,array(2),3)")
org.apache.spark.sql.AnalysisException: unresolved operator 'Intersect;
scala> sql("select 1,2,3 except (select 1,array(2),3)")
org.apache.spark.sql.AnalysisException: unresolved operator 'Except;
```
**After**
```scala
scala> sql("select 1,2,3 union (select 1,array(2),3)")
org.apache.spark.sql.AnalysisException: Union can only be performed on tables with the compatible column types. ArrayType(IntegerType,false) <> IntegerType at the second column of the second table;
scala> sql("select 1,2,3 intersect (select 1,array(2),3)")
org.apache.spark.sql.AnalysisException: Intersect can only be performed on tables with the compatible column types. ArrayType(IntegerType,false) <> IntegerType at the second column of the second table;
scala> sql("select 1,2,3 except (select array(1),array(2),3)")
org.apache.spark.sql.AnalysisException: Except can only be performed on tables with the compatible column types. ArrayType(IntegerType,false) <> IntegerType at the first column of the second table;
```
## How was this patch tested?
Pass the Jenkins test with a new test case.
Author: Dongjoon Hyun <dongjoon@apache.org>
Closes #14355 from dongjoon-hyun/SPARK-16726.
Diffstat (limited to 'tools')
0 files changed, 0 insertions, 0 deletions