eldenmoon commented on code in PR #19543:
URL: https://github.com/apache/doris/pull/19543#discussion_r1202175931


##########
be/src/vec/data_types/serde/data_type_string_serde.cpp:
##########
@@ -122,6 +123,34 @@ void DataTypeStringSerDe::read_column_from_arrow(IColumn& 
column, const arrow::A
         }
     }
 }
-
+template <bool is_binary_format>
+Status DataTypeStringSerDe::_write_column_to_mysql(
+        const IColumn& column, std::vector<MysqlRowBuffer<is_binary_format>>& 
result, int row_idx,
+        int start, int end, int scale, bool col_const) const {
+    int buf_ret = 0;
+    auto& col = assert_cast<const ColumnString&>(column);
+    for (ssize_t i = start; i < end; ++i) {
+        if (0 != buf_ret) {
+            return Status::InternalError("pack mysql buffer failed.");
+        }
+        const auto col_index = index_check_const(i, col_const);
+        const auto string_val = col.get_data_at(col_index);
+        if (string_val.data == nullptr) {
+            if (string_val.size == 0) {
+                // 0x01 is a magic num, not useful actually, just for present 
""
+                char* tmp_val = reinterpret_cast<char*>(0x01);
+                buf_ret = result[row_idx].push_string(tmp_val, 
string_val.size);
+            } else {
+                buf_ret = result[row_idx].push_null();
+            }
+        } else {
+            buf_ret = result[row_idx].push_string("\"", 1);

Review Comment:
   do not push multiple times, since `_field_pos` will be polluted



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