Uh oh!
There was an error while loading. Please reload this page.
[function](cast)Make string casting to integers more like MySQL's behavior - #38847
Conversation
doris-robot
commented
Aug 5, 2024
Thank you for your contribution to Apache Doris. Since 2024-03-18, the Document has been moved to doris-website. |
| static inline bool is_all_digit(const char* __restrict s, int len) { | ||
| for (int i = 0; i < len; ++i) { | ||
| if (!LIKELY(s[i] >= '0' && s[i] <= '9')) { |
There was a problem hiding this comment.
warning: boolean expression can be simplified by DeMorgan's theorem [readability-simplify-boolean-expr]
if (!LIKELY(s[i] >= '0' && s[i] <= '9')) {
^Additional context
be/src/common/compiler_util.h:34: expanded from macro 'LIKELY'
#defineLIKELY(expr) __builtin_expect(!!(expr), 1)
^| 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.
warning: boolean expression can be simplified by DeMorgan's theorem [readability-simplify-boolean-expr]
if ((UNLIKELY(i == first || (!is_all_whitespace(s + i, len - i) &&
^Additional context
be/src/common/compiler_util.h:35: expanded from macro 'UNLIKELY'
#defineUNLIKELY(expr) __builtin_expect(!!(expr), 0)
^| val = val * 10 + digit; | ||
| } else { | ||
| if ((UNLIKELY(!is_all_whitespace(s + i, len - i)))) { | ||
| if ((UNLIKELY(!is_all_whitespace(s + i, len - i) && |
There was a problem hiding this comment.
warning: boolean expression can be simplified by DeMorgan's theorem [readability-simplify-boolean-expr]
if ((UNLIKELY(!is_all_whitespace(s + i, len - i) &&
^Additional context
be/src/common/compiler_util.h:35: expanded from macro 'UNLIKELY'
#defineUNLIKELY(expr) __builtin_expect(!!(expr), 0)
^Mryange
commented
Aug 5, 2024
run buildall |
doris-robot
commented
Aug 5, 2024
TPC-H: Total hot run time: 41877 ms |
doris-robot
commented
Aug 5, 2024
TPC-DS: Total hot run time: 169226 ms |
doris-robot
commented
Aug 5, 2024
ClickBench: Total hot run time: 30.48 s |
40b3054 to
ec08f35CompareMryange
commented
Aug 5, 2024
run buildall |
doris-robot
commented
Aug 5, 2024
TPC-H: Total hot run time: 41735 ms |
doris-robot
commented
Aug 5, 2024
TPC-DS: Total hot run time: 168920 ms |
doris-robot
commented
Aug 5, 2024
ClickBench: Total hot run time: 30.45 s |
Mryange
commented
Aug 5, 2024
run buildall |
doris-robot
commented
Aug 5, 2024
TPC-H: Total hot run time: 41797 ms |
doris-robot
commented
Aug 5, 2024
TPC-DS: Total hot run time: 167928 ms |
doris-robot
commented
Aug 5, 2024
ClickBench: Total hot run time: 29.9 s |
Mryange
commented
Aug 6, 2024
run buildall |
doris-robot
commented
Aug 6, 2024
TPC-H: Total hot run time: 41501 ms |
doris-robot
commented
Aug 6, 2024
TPC-DS: Total hot run time: 169537 ms |
doris-robot
commented
Aug 6, 2024
ClickBench: Total hot run time: 30.11 s |
PR approved by at least one committer and no changes requested. |
PR approved by anyone and no changes requested. |
d92dbf4 to
ad92efdCompareMryange
commented
Aug 6, 2024
run buildall |
doris-robot
commented
Aug 6, 2024
TPC-H: Total hot run time: 41756 ms |
doris-robot
commented
Aug 6, 2024
TPC-DS: Total hot run time: 169248 ms |
doris-robot
commented
Aug 6, 2024
ClickBench: Total hot run time: 29.89 s |
doris-robot
commented
Aug 7, 2024
ClickBench: Total hot run time: 30.15 s |
26023c5 to
800af2bCompareMryange
commented
Aug 8, 2024
run buildall |
doris-robot
commented
Aug 8, 2024
TPC-H: Total hot run time: 39514 ms |
Mryange
commented
Aug 18, 2024
run buildall |
doris-robot
commented
Aug 18, 2024
TPC-H: Total hot run time: 38461 ms |
doris-robot
commented
Aug 18, 2024
TPC-DS: Total hot run time: 196477 ms |
doris-robot
commented
Aug 18, 2024
ClickBench: Total hot run time: 31.54 s |
Mryange
commented
Aug 18, 2024
run buildall |
doris-robot
commented
Aug 18, 2024
TPC-H: Total hot run time: 37891 ms |
doris-robot
commented
Aug 18, 2024
TPC-DS: Total hot run time: 195602 ms |
doris-robot
commented
Aug 18, 2024
ClickBench: Total hot run time: 31.36 s |
PR approved by at least one committer and no changes requested. |
…avior (#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.-->
…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.-->
#41541) …avior (#38847) #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.--> ## Proposed changes Issue Number: close #xxx <!--Describe your changes.--> --------- Co-authored-by: Xinyi Zou <zouxinyi02@gmail.com>
…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.-->
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