sduzh opened a new issue #4218:
URL: https://github.com/apache/incubator-doris/issues/4218


   **Describe the bug**
   Wrong result of query with cast
   
   **To Reproduce**
   ```
   CREATE TABLE `t3` (
     `c0` varchar(1)
   ) ENGINE=OLAP
   DUPLICATE KEY(`c0`)
   COMMENT "OLAP"
   DISTRIBUTED BY HASH(`c0`) BUCKETS 10
   PROPERTIES (
   "replication_num" = "1",
   "in_memory" = "false",
   "storage_format" = "DEFAULT"
   );
   insert into t3 values(''),(NULL),('N'),('w');
   SELECT *FROM t3 WHERE (CAST(t3.c0 AS BOOLEAN)) is NULL;
   ```
   
   **Expected behavior**
   ```
   +------+
   | c0   |
   +------+
   | NULL |
   | NULL |
   | NULL |
   | NULL |
   +------+
   ```
   
   **Real behavior**
   ```
   +------+
   | c0   |
   +------+
   | NULL |
   +------+
   ```
   
   ** Additional Context**
   ```
   mysql(sduzh) > select * from t3;
   +------+
   | c0   |
   +------+
   |      |
   | N    |
   | w    |
   | NULL |
   +------+
   
   mysql(sduzh)> select CAST('' AS BOOLEAN);
   +---------------------+
   | CAST('' AS BOOLEAN) |
   +---------------------+
   |                NULL |
   +---------------------+
   1 row in set (0.02 sec)
   
   mysql(sduzh)> select CAST('w' AS BOOLEAN);
   +----------------------+
   | CAST('w' AS BOOLEAN) |
   +----------------------+
   |                 NULL |
   +----------------------+
   1 row in set (0.01 sec)
   
   mysql(sduzh)> select CAST('n' AS BOOLEAN);
   +----------------------+
   | CAST('n' AS BOOLEAN) |
   +----------------------+
   |                 NULL |
   +----------------------+
   1 row in set (0.02 sec)
   
   ```
   


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



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

Reply via email to