zhiqiang-hhhh commented on PR #32518:
URL: https://github.com/apache/doris/pull/32518#issuecomment-2022521875

   > @zhiqiang-hhhh
   > 
   > Hi, I wonder what is the correct answer of this sql: `select cast(a as 
decimal(30, 4)) from (select cast("9999-12-31 23:59:59.999999" as datetime(6)) 
a) t1;`
   > 
   > For MYSQL, the answer is:
   > 
   > ```sql
   > +---------------------------+
   > | cast(a as decimal(30, 4)) |
   > +---------------------------+
   > |       99991231235960.0000 |
   > +---------------------------+
   > ```
   > 
   > For my implementation, it is:
   > 
   > ```sql
   > +-----------------------------+
   > | cast(a as DECIMALV3(30, 4)) |
   > +-----------------------------+
   > |         99991231235959.9999 |
   > +-----------------------------+
   > 1 row in set (0.02 sec)
   > ```
   
   There is something strange about behaviour of mysql, it is rounding but 
finished halfway, and doris is just doing truncate.
   I just tests pg and sql server ,they all have different behaviour. 
   
   I think we can just keep doing truncate, but we need more conner test to 
make sure that we will do truncate in all situations like above.
   
   


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