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


##########
be/src/vec/data_types/serde/data_type_date64_serde.cpp:
##########
@@ -23,10 +23,122 @@
 
 #include "gutil/casts.h"
 #include "vec/columns/column_const.h"
+#include "vec/io/io_helper.h"
 
 namespace doris {
 namespace vectorized {
 
+void DataTypeDate64SerDe::serialize_one_cell_to_text(const IColumn& column, 
int row_num,
+                                                     BufferWritable& bw,
+                                                     const FormatOptions& 
options) const {
+    auto result = check_column_const_set_readability(column, row_num);
+    ColumnPtr ptr = result.first;
+    row_num = result.second;
+
+    Int64 int_val = assert_cast<const ColumnInt64&>(*ptr).get_element(row_num);
+    if (options.use_lib_format) {
+        tm time_tm;
+        memset(&time_tm, 0, sizeof(time_tm));
+        time_tm.tm_mday = static_cast<int>(int_val & 31);
+        time_tm.tm_mon = static_cast<int>(int_val >> 5 & 15) - 1;
+        time_tm.tm_year = static_cast<int>(int_val >> 9) - 1900;
+        char buf[20] = {'\0'};

Review Comment:
   这样写太废了,相当于这里先搞一个buf 数组,然后填充;再转string 这样会再copy 一次;然后buffer writable 会继续copy 一次



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