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

feiwang updated SPARK-29860:
----------------------------
    Description: 
The follow statement would throw an exception.


{code:java}
      sql("create table ta(id Decimal(18,0)) using parquet")
      sql("create table tb(id Decimal(19,0)) using parquet")
      sql("select * from ta where id in (select id from tb)").shown()
{code}


{code:java}
// Some comments here
cannot resolve '(default.ta.`id` IN (listquery()))' due to data type mismatch: 
The data type of one or more elements in the left hand side of an IN subquery
is not compatible with the data type of the output of the subquery
Mismatched columns:
[(default.ta.`id`:decimal(18,0), default.tb.`id`:decimal(19,0))]
Left side:
[decimal(18,0)].
Right side:
[decimal(19,0)].;;
'Project [*]
+- 'Filter id#219 IN (list#218 [])
   :  +- Project [id#220]
   :     +- SubqueryAlias `default`.`tb`
   :        +- Relation[id#220] parquet
   +- SubqueryAlias `default`.`ta`
      +- Relation[id#219] parquet
{code}



  was:
The follow statement would throw an exception.


{code:java}
      sql("create table ta(id Decimal(18,0)) using parquet")
      sql("create table tb(id Decimal(19,0)) using parquet")
      sql("select * from ta where id in (select id from tb)").shown()
{code}


{code:java}
// Some comments here
public String getFoo()
{
    return foo;
}
{code}




> [SQL] Fix data type mismatch issue for inSubQuery
> -------------------------------------------------
>
>                 Key: SPARK-29860
>                 URL: https://issues.apache.org/jira/browse/SPARK-29860
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 2.4.4
>            Reporter: feiwang
>            Priority: Major
>
> The follow statement would throw an exception.
> {code:java}
>       sql("create table ta(id Decimal(18,0)) using parquet")
>       sql("create table tb(id Decimal(19,0)) using parquet")
>       sql("select * from ta where id in (select id from tb)").shown()
> {code}
> {code:java}
> // Some comments here
> cannot resolve '(default.ta.`id` IN (listquery()))' due to data type 
> mismatch: 
> The data type of one or more elements in the left hand side of an IN subquery
> is not compatible with the data type of the output of the subquery
> Mismatched columns:
> [(default.ta.`id`:decimal(18,0), default.tb.`id`:decimal(19,0))]
> Left side:
> [decimal(18,0)].
> Right side:
> [decimal(19,0)].;;
> 'Project [*]
> +- 'Filter id#219 IN (list#218 [])
>    :  +- Project [id#220]
>    :     +- SubqueryAlias `default`.`tb`
>    :        +- Relation[id#220] parquet
>    +- SubqueryAlias `default`.`ta`
>       +- Relation[id#219] parquet
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to