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

Nattavut Sutyanyong commented on SPARK-19017:
---------------------------------------------

I also have the output from a MySQL system. Note that I changed the tuple in 
{{t2}} to {{(3, null)}} to avoid having the value {{1}} twice but it should not 
make any difference.

{code}
$ mysql -V
mysql  Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 
5.1

mysql> create table mydb.t1(t1a int, t1b int);
Query OK, 0 rows affected (0.08 sec)

mysql> create table mydb.t2(t2a int, t2b int);
Query OK, 0 rows affected (0.11 sec)

mysql> insert into mydb.t1 values(2,1);
Query OK, 1 row affected (0.00 sec)

mysql> insert into mydb.t2 values(3, null);
Query OK, 1 row affected (0.00 sec)

mysql> select * from mydb.t1 where(t1a, t1b) not in(select t2a, t2b from 
mydb.t2);
+------+------+
| t1a  | t1b  |
+------+------+
|    2 |    1 |
+------+------+
1 row in set (0.00 sec)
{code}

> NOT IN subquery with more than one column may return incorrect results
> ----------------------------------------------------------------------
>
>                 Key: SPARK-19017
>                 URL: https://issues.apache.org/jira/browse/SPARK-19017
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.0.0, 2.0.1, 2.0.2, 2.1.0
>            Reporter: Nattavut Sutyanyong
>
> When putting more than one column in the NOT IN, the query may not return 
> correctly if there is a null data. We can demonstrate the problem with the 
> following data set and query:
> {code}
> Seq((2,1)).toDF("a1","b1").createOrReplaceTempView("t1")
> Seq[(java.lang.Integer,java.lang.Integer)]((1,null)).toDF("a2","b2").createOrReplaceTempView("t2")
> sql("select * from t1 where (a1,b1) not in (select a2,b2 from t2)").show
> +---+---+
> | a1| b1|
> +---+---+
> +---+---+
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to