You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2021/08/26 02:19:15 UTC

[GitHub] [incubator-doris] yangzhg commented on a change in pull request #6506: [Feature] Support for storage layer benchmark

yangzhg commented on a change in pull request #6506:
URL: https://github.com/apache/incubator-doris/pull/6506#discussion_r696237768



##########
File path: be/test/olap/tablet_schema_helper.h
##########
@@ -123,4 +123,28 @@ void set_column_value_by_type(FieldType fieldType, int src, char* target, MemPoo
     }
 }
 
+void set_column_value_by_type(FieldType fieldType, std::string src, char* target, MemPool* pool,
+                              size_t _length = 0) {
+    if (fieldType == OLAP_FIELD_TYPE_CHAR) {
+        char* src_value = &src[0];
+        int src_len = src.size();
+
+        auto* dest_slice = (Slice*)target;
+        dest_slice->size = _length;
+        dest_slice->data = (char*)pool->allocate(dest_slice->size);
+        memcpy(dest_slice->data, src_value, src_len);
+        memset(dest_slice->data + src_len, 0, dest_slice->size - src_len);
+    } else if (fieldType == OLAP_FIELD_TYPE_VARCHAR) {
+        char* src_value = &src[0];
+        int src_len = src.size();
+
+        auto* dest_slice = (Slice*)target;
+        dest_slice->size = src_len;
+        dest_slice->data = (char*)pool->allocate(src_len);

Review comment:
       add String type




-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org