zhiqiang-hhhh commented on PR #32518: URL: https://github.com/apache/doris/pull/32518#issuecomment-2017470658
> @zhiqiang-hhhh Hi, I just tested below in Doris: > > ```sql > mysql> select cast(c as decimal) from (select cast("9999-12-31" as datetime) c) t3; > ERROR 1105 (HY000): errCode = 2, detailMessage = (127.0.0.1)[E-124]Arithmetic overflow, convert failed from 703674110198153216, expected data is [-999999999, 999999999] > ``` > > For MySQL, the result is: > > ```sql > +--------------------+ > | cast(c as decimal) | > +--------------------+ > | 9999999999 | > +--------------------+ > ``` > > I think for datetime, current version is okay because of the strict overflow detection in Doris. I picked this issue from [Bug summary for doris 2.0.4](https://github.com/apache/doris/issues/32234). This is because we have incorrect integer value of Datetime. ```sql select cast(c as decimal(30,9)) from (select cast("9999-12-31" as datetime) c) t3 -------------- +------------------------------+ | cast(c as DECIMALV3(30, 9)) | +------------------------------+ | 703674110198153216.000000000 | +------------------------------+ 1 row in set (0.02 sec) ``` So we need a similar fix for datetime too. -- 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