yiguolei commented on code in PR #54760:
URL: https://github.com/apache/doris/pull/54760#discussion_r2281113956


##########
be/src/util/mysql_row_buffer.cpp:
##########
@@ -179,10 +179,8 @@ static char* add_largeint(int128_t data, char* pos, bool 
dynamic_mode) {
 
 template <typename T>
 char* add_float(T data, char* pos, bool dynamic_mode) {
-    int length = 0;
-    if constexpr (std::is_same_v<T, float> || std::is_same_v<T, double>) {
-        length = fast_to_buffer(data, pos + !dynamic_mode);
-    }
+    static_assert(std::is_same_v<T, float> || std::is_same_v<T, double>);
+    int length = fast_to_buffer(data, pos + !dynamic_mode);

Review Comment:
   这个为什么要单独写?而不是调用to string?



##########
be/src/util/to_string.h:
##########
@@ -99,49 +99,18 @@ inline int fast_to_buffer(T value, char* buffer) {
             end = buffer + neg_inf_str_len;
         }
     } else {
-        end = fmt::format_to(buffer, FMT_COMPILE("{}"), value);
+        if constexpr (std::is_same_v<T, float>) {
+            end = fmt::format_to(buffer, FMT_COMPILE("{:.{}g}"), value,

Review Comment:
   这个为什么要单独写?而不是调用to string?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to