You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Apache Spark (JIRA)" <ji...@apache.org> on 2018/07/25 09:34:00 UTC

[jira] [Commented] (SPARK-24916) Fix type coercion for IN expression with subquery

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

Apache Spark commented on SPARK-24916:
--------------------------------------

User 'wangyum' has created a pull request for this issue:
https://github.com/apache/spark/pull/21871

> Fix type coercion for IN expression with subquery
> -------------------------------------------------
>
>                 Key: SPARK-24916
>                 URL: https://issues.apache.org/jira/browse/SPARK-24916
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.2.0, 2.3.0
>            Reporter: Yuming Wang
>            Priority: Major
>
> How to reproduce:
> {code:sql}
> CREATE TEMPORARY VIEW t4 AS SELECT * FROM VALUES
>   (CAST(1 AS DOUBLE), CAST(2 AS STRING), CAST(3 AS STRING))
> AS t1(t4a, t4b, t4c);
> CREATE TEMPORARY VIEW t5 AS SELECT * FROM VALUES
>   (CAST(1 AS DECIMAL(18, 0)), CAST(2 AS STRING), CAST(3 AS BIGINT))
> AS t1(t5a, t5b, t5c);
> SELECT * FROM t4
> WHERE
> (t4a, t4b, t4c) IN (SELECT t5a,
>                            t5b,
>                            t5c
>                     FROM t5);
> {code}
> Will throw exception:
> {noformat}
> org.apache.spark.sql.AnalysisException
> cannot resolve '(named_struct('t4a', t4.`t4a`, 't4b', t4.`t4b`, 't4c', t4.`t4c`) 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:
> [(t4.`t4a`:double, t5.`t5a`:decimal(18,0)), (t4.`t4c`:string, t5.`t5c`:bigint)]
> Left side:
> [double, string, string].
> Right side:
> [decimal(18,0), string, bigint].;
> {noformat}
> But it success on Spark 2.1.x.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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