You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "feiwang (Jira)" <ji...@apache.org> on 2019/11/12 15:56:00 UTC

[jira] [Updated] (SPARK-29860) [SQL] Fix data type mismatch issue for inSubQuery

     [ 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}

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


> [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}
> 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



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

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