wangshuo128 commented on a change in pull request #8234:
URL: https://github.com/apache/incubator-doris/pull/8234#discussion_r825293002



##########
File path: be/src/olap/aggregate_func.h
##########
@@ -580,6 +581,53 @@ struct 
AggregateFuncTraits<OLAP_FIELD_AGGREGATION_BITMAP_UNION, OLAP_FIELD_TYPE_
         : public AggregateFuncTraits<OLAP_FIELD_AGGREGATION_BITMAP_UNION, 
OLAP_FIELD_TYPE_OBJECT> {
 };
 
+template <>
+struct AggregateFuncTraits<OLAP_FIELD_AGGREGATION_QUANTILE_UNION, 
OLAP_FIELD_TYPE_QUANTILE_STATE> {
+    static void init(RowCursorCell* dst, const char* src, bool src_null, 
MemPool* mem_pool,
+                     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());
+
+        // we use zero size represent this slice is a agg object
+        dst_slice->size = 0;
+        auto* quantile_state = new QuantileState<double>(*src_slice);
+
+        
mem_pool->mem_tracker()->Consume(quantile_state->get_serialized_size());
+
+        dst_slice->data = reinterpret_cast<char*>(quantile_state);
+
+        agg_pool->add(quantile_state);
+    }
+
+    static void update(RowCursorCell* dst, const RowCursorCell& src, MemPool* 
mem_pool) {
+        DCHECK_EQ(src.is_null(), false);
+
+        auto* dst_slice = reinterpret_cast<Slice*>(dst->mutable_cell_ptr());
+        auto* src_slice = reinterpret_cast<const Slice*>(src.cell_ptr());

Review comment:
       Ah, I see, my mistake.




-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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

Reply via email to