[ 
https://issues.apache.org/jira/browse/SPARK-29667?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16987119#comment-16987119
 ] 

Aman Omer commented on SPARK-29667:
-----------------------------------

Hi [~jessielin], did you observed same issue with any other data type?

{code:java}
SELECT * FROM (VALUES (1.0), (2.0) AS t1(col1))
    WHERE col1 IN
        (SELECT * FROM (VALUES (1.0), (2.0), (3.00) AS t2(col2)));
{code}
Above query will fail with following error

{noformat}
Mismatched columns:
[(__auto_generated_subquery_name.`col1`:decimal(2,1), 
__auto_generated_subquery_name.`col2`:decimal(3,2))]
Left side:
[decimal(2,1)].
Right side:
[decimal(3,2)].
{noformat}

Since, `3.00` in subquery will upcast all element in column to decimal(3,2).

> implicitly convert mismatched datatypes on right side of "IN" operator
> ----------------------------------------------------------------------
>
>                 Key: SPARK-29667
>                 URL: https://issues.apache.org/jira/browse/SPARK-29667
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 2.4.3
>            Reporter: Jessie Lin
>            Priority: Minor
>
> Ran into error on this sql
> Mismatched columns:
> [(a.`id`:decimal(28,0), db1.table1.`id`:decimal(18,0))] 
> the sql and clause
>       AND   a.id in (select id from db1.table1 where col1 = 1 group by id)
> Once I cast decimal(18,0) to decimal(28,0) explicitly above, the sql ran just 
> fine. Can the sql engine cast implicitly in this case?
>  
>  
>  
>  



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