caiconghui commented on a change in pull request #8500:
URL: https://github.com/apache/incubator-doris/pull/8500#discussion_r829690739
##########
File path: be/src/olap/types.cpp
##########
@@ -44,27 +44,24 @@ class ScalarTypeInfoResolver {
DECLARE_SINGLETON(ScalarTypeInfoResolver);
public:
- std::shared_ptr<const TypeInfo> get_type_info(const FieldType t) {
- auto pair = _scalar_type_mapping.find(t);
- DCHECK(pair != _scalar_type_mapping.end()) << "Bad field type: " << t;
- return pair->second;
+ std::shared_ptr<const TypeInfo> get_type_info(const FieldType t) const {
+ return _scalar_type_mapping[t];
Review comment:
how about use template here?
so we don't keep OLAP_FIELD_TYPE_SIZE and _scalar_type_mapping?
##########
File path: be/src/olap/types.cpp
##########
@@ -44,27 +44,24 @@ class ScalarTypeInfoResolver {
DECLARE_SINGLETON(ScalarTypeInfoResolver);
public:
- std::shared_ptr<const TypeInfo> get_type_info(const FieldType t) {
- auto pair = _scalar_type_mapping.find(t);
- DCHECK(pair != _scalar_type_mapping.end()) << "Bad field type: " << t;
- return pair->second;
+ std::shared_ptr<const TypeInfo> get_type_info(const FieldType t) const {
+ return _scalar_type_mapping[t];
Review comment:
It should be that template functions are specialized for each type at
compile time
--
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]