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