[function](cast)Make string casting to integers more like MySQL's beh…#41541
[function](cast)Make string casting to integers more like MySQL's beh…#41541yiguolei merged 2 commits intoapache:branch-2.1from
Conversation
…avior (apache#38847) ## Proposed changes There are two issues here. First, the results of casting are inconsistent between FE and BE . ``` FE mysql [(none)]>select cast('3.000' as int); +----------------------+ | cast('3.000' as INT) | +----------------------+ | 3 | +----------------------+ mysql [(none)]>set debug_skip_fold_constant = true; BE mysql [(none)]>select cast('3.000' as int); +----------------------+ | cast('3.000' as INT) | +----------------------+ | NULL | +----------------------+ ``` The second issue is that casting on BE converts '3.0' to null. Here, the casting logic for FE and BE has been unified <!--Describe your changes.-->
|
Thank you for your contribution to Apache Doris. Since 2024-03-18, the Document has been moved to doris-website. |
|
run buildall |
|
run beut |
4c337aa to
cb9d8ba
Compare
|
run buildall |
|
TeamCity be ut coverage result: |
|
run buildall |
|
TeamCity be ut coverage result: |
|
run p0 |
| val = val * 10 + digit; | ||
| } else { | ||
| if ((UNLIKELY(i == first || !is_all_whitespace(s + i, len - i)))) { | ||
| if ((UNLIKELY(i == first || (!is_all_whitespace(s + i, len - i) && |
There was a problem hiding this comment.
之前的代码对于 “3 ” 能转为3
这里好像对 “3.1 ” 就不能转为3了
…avior (#38847)
#38847
Proposed changes
There are two issues here. First, the results of casting are inconsistent between FE and BE .
The second issue is that casting on BE converts '3.0' to null. Here, the casting logic for FE and BE has been unified
Proposed changes
Issue Number: close #xxx