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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]