Mryange commented on PR #33868:
URL: https://github.com/apache/doris/pull/33868#issuecomment-2066131162

   > > > 
https://dev.mysql.com/doc/refman/8.0/en/cast-functions.html#function_cast
   > > > cast function of mysql do not support using bool as type argument.
   > > 
   > > 
   > > But there is implicit conversion to boolean. https://dbfiddle.uk/FGUsvxTk
   > 
   > why do you think there is an implicit conversion?
   > 
   > https://dev.mysql.com/doc/refman/8.3/en/logical-operators.html#operator_and
   > 
   > oprator_and checks whether operands are zero or NULL, it has nothing to do 
with type convert.
   
   My mistake, as doris implementation involves implicit conversion.
   But such results in doris
   ```
   mysql []>set enable_fold_constant_by_be = false;
   Query OK, 0 rows affected (0.00 sec)
   
   mysql []>select 3.14 and 3.0;
   +--------------------------------------------------+
   | (cast(3.14 as BOOLEAN) AND cast(3.0 as BOOLEAN)) |
   +--------------------------------------------------+
   |                                                3 |
   +--------------------------------------------------+
   1 row in set (0.03 sec)
   
   mysql []>desc select 3.14 and 3.0;
   +----------------------------------------------------------+
   | Explain String(Nereids Planner)                          |
   +----------------------------------------------------------+
   | PLAN FRAGMENT 0                                          |
   |   OUTPUT EXPRS:                                          |
   |     (cast(3.14 as BOOLEAN) AND cast(3.0 as BOOLEAN))[#0] |
   |   PARTITION: UNPARTITIONED                               |
   |                                                          |
   |   HAS_COLO_PLAN_NODE: false                              |
   |                                                          |
   |   VRESULT SINK                                           |
   |      MYSQL_PROTOCAL                                      |
   |                                                          |
   |   0:VUNION(30)                                           |
   |      constant exprs:                                     |
   |          CAST(3.14 AS BOOLEAN) AND CAST(3.0 AS BOOLEAN)  |
   +----------------------------------------------------------+
   13 rows in set (0.01 sec)
   
   mysql []>select 3.14 and 2.0;
   +--------------------------------------------------+
   | (cast(3.14 as BOOLEAN) AND cast(2.0 as BOOLEAN)) |
   +--------------------------------------------------+
   |                                                2 |
   +--------------------------------------------------+
   ```
   


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

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to