github-actions[bot] commented on code in PR #38847:
URL: https://github.com/apache/doris/pull/38847#discussion_r1703474583


##########
be/src/util/string_parser.hpp:
##########
@@ -243,6 +243,20 @@ class StringParser {
         return true;
     }
 
+    // For strings like "3.0", "3.123", and "3.", can parse them as 3.
+    static inline bool is_float_suffix(const char* __restrict s, int len) {
+        return (s[0] == '.' && is_all_digit(s + 1, len - 1));
+    }
+
+    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')) {

Review Comment:
   warning: boolean expression can be simplified by DeMorgan's theorem 
[readability-simplify-boolean-expr]
   ```cpp
               if (!LIKELY(s[i] >= '0' && s[i] <= '9')) {
                    ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/common/compiler_util.h:34:** expanded from macro 'LIKELY'
   ```cpp
   #define LIKELY(expr) __builtin_expect(!!(expr), 1)
                                          ^
   ```
   
   </details>
   



##########
be/src/util/string_parser.hpp:
##########
@@ -306,7 +320,8 @@
             }
             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) &&

Review Comment:
   warning: boolean expression can be simplified by DeMorgan's theorem 
[readability-simplify-boolean-expr]
   ```cpp
               if ((UNLIKELY(i == first || (!is_all_whitespace(s + i, len - i) 
&&
                    ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/common/compiler_util.h:35:** expanded from macro 'UNLIKELY'
   ```cpp
   #define UNLIKELY(expr) __builtin_expect(!!(expr), 0)
                                            ^
   ```
   
   </details>
   



##########
be/src/util/string_parser.hpp:
##########
@@ -448,7 +463,8 @@
             T digit = s[i] - '0';
             val = val * 10 + digit;
         } else {
-            if ((UNLIKELY(!is_all_whitespace(s + i, len - i)))) {
+            if ((UNLIKELY(!is_all_whitespace(s + i, len - i) &&

Review Comment:
   warning: boolean expression can be simplified by DeMorgan's theorem 
[readability-simplify-boolean-expr]
   ```cpp
               if ((UNLIKELY(!is_all_whitespace(s + i, len - i) &&
                    ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/common/compiler_util.h:35:** expanded from macro 'UNLIKELY'
   ```cpp
   #define UNLIKELY(expr) __builtin_expect(!!(expr), 0)
                                            ^
   ```
   
   </details>
   



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