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

Dongjoon Hyun updated SPARK-16726:
----------------------------------
    Component/s: SQL

> 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
>          Components: SQL
>            Reporter: Dongjoon Hyun
>            Assignee: Dongjoon Hyun
>            Priority: Minor
>             Fix For: 2.1.0
>
>
> 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