You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/07/30 09:49:18 UTC

[GitHub] [incubator-doris] sduzh opened a new issue #4218: Wrong result of querying with cast expression in where clause

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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] yangzhg commented on issue #4218: Wrong result of querying with cast expression in where clause

Posted by GitBox <gi...@apache.org>.
yangzhg commented on issue #4218:
URL: https://github.com/apache/incubator-doris/issues/4218#issuecomment-666911408


   0, "0", false, "false" can cast to false
   1 , "1", true, "true" can cast to true
   other cast to null


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] morningman closed issue #4218: Wrong result of querying with cast expression in where clause

Posted by GitBox <gi...@apache.org>.
morningman closed issue #4218:
URL: https://github.com/apache/incubator-doris/issues/4218


   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org