eldenmoon commented on code in PR #32620:
URL: https://github.com/apache/doris/pull/32620#discussion_r1580808405


##########
be/src/olap/rowset/segment_v2/inverted_index_reader.cpp:
##########
@@ -73,6 +73,66 @@
 
 namespace doris::segment_v2 {
 
+template <PrimitiveType PT>
+Status InvertedIndexQueryParamFactory::create_query_value(
+        const void* value, std::unique_ptr<InvertedIndexQueryParamFactory>& 
result_param) {
+    using CPP_TYPE = typename PrimitiveTypeTraits<PT>::CppType;
+    std::unique_ptr<InvertedIndexQueryParam<PT>> param =
+            InvertedIndexQueryParam<PT>::create_unique();
+    auto&& storage_val = PrimitiveTypeConvertor<PT>::to_storage_field_type(
+            *reinterpret_cast<const CPP_TYPE*>(value));
+    param->set_value(&storage_val);
+    result_param = std::move(param);
+    return Status::OK();
+};
+
+template Status 
InvertedIndexQueryParamFactory::create_query_value<PrimitiveType::TYPE_BOOLEAN>(
+        const void* value, std::unique_ptr<InvertedIndexQueryParamFactory>& 
result_param);
+template Status 
InvertedIndexQueryParamFactory::create_query_value<PrimitiveType::TYPE_TINYINT>(
+        const void* value, std::unique_ptr<InvertedIndexQueryParamFactory>& 
result_param);
+template Status 
InvertedIndexQueryParamFactory::create_query_value<PrimitiveType::TYPE_SMALLINT>(
+        const void* value, std::unique_ptr<InvertedIndexQueryParamFactory>& 
result_param);
+template Status 
InvertedIndexQueryParamFactory::create_query_value<PrimitiveType::TYPE_INT>(
+        const void* value, std::unique_ptr<InvertedIndexQueryParamFactory>& 
result_param);
+template Status 
InvertedIndexQueryParamFactory::create_query_value<PrimitiveType::TYPE_BIGINT>(
+        const void* value, std::unique_ptr<InvertedIndexQueryParamFactory>& 
result_param);
+template Status 
InvertedIndexQueryParamFactory::create_query_value<PrimitiveType::TYPE_LARGEINT>(
+        const void* value, std::unique_ptr<InvertedIndexQueryParamFactory>& 
result_param);
+template Status 
InvertedIndexQueryParamFactory::create_query_value<PrimitiveType::TYPE_FLOAT>(
+        const void* value, std::unique_ptr<InvertedIndexQueryParamFactory>& 
result_param);
+template Status 
InvertedIndexQueryParamFactory::create_query_value<PrimitiveType::TYPE_DOUBLE>(
+        const void* value, std::unique_ptr<InvertedIndexQueryParamFactory>& 
result_param);
+template Status 
InvertedIndexQueryParamFactory::create_query_value<PrimitiveType::TYPE_VARCHAR>(
+        const void* value, std::unique_ptr<InvertedIndexQueryParamFactory>& 
result_param);

Review Comment:
   too many duplicated template, use macors instead



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

Reply via email to