EmmyMiao87 opened a new issue #1725: The null result of union stmt is incorrect
URL: https://github.com/apache/incubator-doris/issues/1725
 
 
   **Describe the bug**
   The null result of union stmt is incorrect when the child of union stmt is a 
outer join with the null-supplying column. 
   
   **To Reproduce**
   mysql> CREATE TABLE `empty` (
       ->   `k1` tinyint(4) NOT NULL COMMENT "",
       ->   `k2` tinyint(4) NOT NULL COMMENT ""
       -> ) ENGINE=OLAP
       -> AGGREGATE KEY(`k1`, `k2`)
       -> DISTRIBUTED BY HASH(`k1`) BUCKETS 5
       -> PROPERTIES (
       -> "storage_type" = "COLUMN", "replication_num" = "1"
       -> );
   Query OK, 0 rows affected (0.19 sec)
   
   mysql> CREATE TABLE `left_table` (
       ->   `k1` tinyint(4) NOT NULL COMMENT "",
       ->   `k2` tinyint(4) NOT NULL COMMENT ""
       -> ) ENGINE=OLAP
       -> AGGREGATE KEY(`k1`, `k2`)
       -> DISTRIBUTED BY HASH(`k1`) BUCKETS 5
       -> PROPERTIES (
       -> "storage_type" = "COLUMN", "replication_num" = "1"
       -> );
   Query OK, 0 rows affected (0.07 sec)
   
   mysql> insert into left_table values (1,1);
   Query OK, 1 row affected (0.29 sec)
   
   mysql> (select k2 from empty) union (select b.k2 k2 from left_table a left 
join empty b on a.k1=b.k1);
   +------+
   | k2   |
   +------+
   |    0 |
   +------+
   1 row in set (0.09 sec)
   
   mysql> select b.k2 k2 from left_table a left join empty b on a.k1=b.k1;
   +------+
   | k2   |
   +------+
   | NULL |
   +------+
   1 row in set (0.07 sec)
   
   **Expected behavior**
   +------+
   | k2   |
   +------+
   | NULL |
   +------+
   **Additional context**
   The NULL column must be produced by a outer join.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to