imay commented on a change in pull request #2310: Marising
URL: https://github.com/apache/incubator-doris/pull/2310#discussion_r351162301
##########
File path: be/src/olap/types.h
##########
@@ -374,6 +384,20 @@ struct FieldTypeTraits<OLAP_FIELD_TYPE_DOUBLE> : public
BaseFieldtypeTraits<OLAP
snprintf(buf, sizeof(buf), "%.10f", *reinterpret_cast<const
CppType*>(src));
return std::string(buf);
}
+ static OLAPStatus convert_from(void* dest, const void* src, const
TypeInfo* src_type, MemPool* mem_pool) {
+ //only support float now
+ if(src_type->type() == OLAP_FIELD_TYPE_FLOAT){
+ using SrcType = typename
CppTypeTraits<OLAP_FIELD_TYPE_FLOAT>::CppType;
+ char buf[64];
+ memset(buf,0,sizeof(buf));
+ sprintf(buf,"%f",*reinterpret_cast<const SrcType*>(src));
Review comment:
1. prefer snprintf
2. we prefer add a space after `,`
```suggestion
snprintf(buf, 64, "%f", *reinterpret_cast<const SrcType*>(src));
```
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]