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 2019/09/24 09:51:20 UTC

[GitHub] [incubator-doris] kangkaisen commented on a change in pull request #1854: Avoid SerDe for aggregation query with object pool

kangkaisen commented on a change in pull request #1854: Avoid SerDe for aggregation query with object pool
URL: https://github.com/apache/incubator-doris/pull/1854#discussion_r327525250
 
 

 ##########
 File path: be/src/olap/aggregate_func.h
 ##########
 @@ -398,17 +401,21 @@ struct AggregateFuncTraits<OLAP_FIELD_AGGREGATION_REPLACE, OLAP_FIELD_TYPE_CHAR>
 // so when init, update hll, the src is not null
 template <>
 struct AggregateFuncTraits<OLAP_FIELD_AGGREGATION_HLL_UNION, OLAP_FIELD_TYPE_HLL> {
-    static void init(RowCursorCell* dst, const char* src, bool src_null, Arena* arena) {
+    static void init(RowCursorCell* dst, const char* src, bool src_null, Arena* arena, ObjectPool* agg_pool) {
         DCHECK_EQ(src_null, false);
         dst->set_not_null();
 
         auto* src_slice = reinterpret_cast<const Slice*>(src);
         auto* dst_slice = reinterpret_cast<Slice*>(dst->mutable_cell_ptr());
 
-        dst_slice->size = sizeof(HyperLogLog);
-        // use 'placement new' to allocate HyperLogLog on arena, so that we can control the memory usage.
-        char* mem = arena->Allocate(dst_slice->size);
-        dst_slice->data = (char*) new (mem) HyperLogLog((const uint8_t*)src_slice->data);
+        // we use int32_t max size represent this slice is a agg object
+        dst_slice->size = std::numeric_limits<int32_t>::max();
+        auto* hll = new HyperLogLog((const uint8_t*) src_slice->data);
+        dst_slice->data = reinterpret_cast<char*>(hll);
+
+        arena->track_memory(sizeof(HyperLogLog));
 
 Review comment:
   I agree with you.
   But this should be another issue,  This PR don't change this point.
   We need a better way to estimate the HLL and Bitmap memory usage.
   
   

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org