[ 
https://issues.apache.org/jira/browse/SPARK-16726?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dongjoon Hyun updated SPARK-16726:
----------------------------------
    Description: 
Currently, `UNION/INTERSECT/EXCEPT` query on incompatible types shows a 
misleading error message like `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]

h4. Before
{code}
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;
{code}

h4. After
{code}
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. The first table has `[IntegerType, 
IntegerType, IntegerType]` and second table has `[IntegerType, 
ArrayType(IntegerType,false), IntegerType]`. The 2th column is incompatible;
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. The first table has `[IntegerType, 
IntegerType, IntegerType]` and second table has `[IntegerType, 
ArrayType(IntegerType,false), IntegerType]`. The 2th column is incompatible;
scala> sql("select 1,2,3 except (select 1,array(2),3)")
org.apache.spark.sql.AnalysisException: Except can only be performed on tables 
with the compatible column types. The first table has `[IntegerType, 
IntegerType, IntegerType]` and second table has `[IntegerType, 
ArrayType(IntegerType,false), IntegerType]`. The 2th column is incompatible;
{code}


  was:
Currently, `UNION` query on incompatible types shows a misleading error 
message, e.g., `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]

h4. Before
{code}
scala> sql("select 1 union (select array(1))")
org.apache.spark.sql.AnalysisException: unresolved operator 'Union;
{code}

h4. After
{code}
scala> sql("select 1 union (select array(1))")
org.apache.spark.sql.AnalysisException: Unions can only be performed on tables 
with the compatible column types, but one table has '[IntegerType]' and another 
table has '[ArrayType(IntegerType,false)]';
{code}


        Summary: Improve `Union/Intersect/Except` error messages on 
incompatible types  (was: Improve error message for `Union` queries on 
incompatible types)

> Improve `Union/Intersect/Except` error messages on incompatible types
> ---------------------------------------------------------------------
>
>                 Key: SPARK-16726
>                 URL: https://issues.apache.org/jira/browse/SPARK-16726
>             Project: Spark
>          Issue Type: Improvement
>            Reporter: Dongjoon Hyun
>            Priority: Minor
>
> Currently, `UNION/INTERSECT/EXCEPT` query on incompatible types shows a 
> misleading error message like `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]
> h4. Before
> {code}
> 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;
> {code}
> h4. After
> {code}
> 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. The first table has `[IntegerType, 
> IntegerType, IntegerType]` and second table has `[IntegerType, 
> ArrayType(IntegerType,false), IntegerType]`. The 2th column is incompatible;
> 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. The first table has `[IntegerType, 
> IntegerType, IntegerType]` and second table has `[IntegerType, 
> ArrayType(IntegerType,false), IntegerType]`. The 2th column is incompatible;
> scala> sql("select 1,2,3 except (select 1,array(2),3)")
> org.apache.spark.sql.AnalysisException: Except can only be performed on 
> tables with the compatible column types. The first table has `[IntegerType, 
> IntegerType, IntegerType]` and second table has `[IntegerType, 
> ArrayType(IntegerType,false), IntegerType]`. The 2th column is incompatible;
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to