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 2020/11/24 04:42:47 UTC

[GitHub] [incubator-doris] HappenLee commented on a change in pull request #4938: [Schema change] Support More column type in schema change

HappenLee commented on a change in pull request #4938:
URL: https://github.com/apache/incubator-doris/pull/4938#discussion_r529198744



##########
File path: be/src/olap/types.h
##########
@@ -509,98 +530,55 @@ OLAPStatus convert_int_from_varchar(void* dest, const void* src) {
 }
 
 template <typename T>
-OLAPStatus convert_float_from_varchar(void* dest, const void* src) {
-    using SrcType = typename CppTypeTraits<OLAP_FIELD_TYPE_VARCHAR>::CppType;
-    auto src_value = reinterpret_cast<const SrcType *>(src);
-    StringParser::ParseResult parse_res;
-    T result = StringParser::string_to_float<T>(src_value->get_data(), src_value->get_size(), &parse_res);
-    if (UNLIKELY(parse_res != StringParser::PARSE_SUCCESS)) {
-        return OLAPStatus::OLAP_ERR_INVALID_SCHEMA;
-    }
-    *reinterpret_cast<T*>(dest) = result;
-    return OLAPStatus::OLAP_SUCCESS;
+OLAPStatus arithmetic_convert_from_char(void* dest, const void* src) {
+    prepare_char_before_convert(src);
+    return arithmetic_convert_from_varchar<T>(dest, src);
 }
 
-template<FieldType field_type>
-struct FieldTypeTraits : public BaseFieldtypeTraits<field_type> { };
+// Using ArithmeTicFieldtypeTraits to Derived code for OLAP_FIELD_TYPE_XXXINT, OLAP_FIELD_TYPE_FLOAT,
+// OLAP_FIELD_TYPE_DOUBLE, to reduce redundant code
+template <FieldType fieldType, bool isArithmetic>
+struct ArithmeTicFieldtypeTraits : public BaseFieldtypeTraits<fieldType> {

Review comment:
       OK,i will consider to change the name of it




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

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