Yukang-Lian commented on code in PR #13056: URL: https://github.com/apache/doris/pull/13056#discussion_r989910566
########## be/src/exprs/aggregate_functions.cpp: ########## @@ -2534,6 +2535,97 @@ IntVal AggregateFunctions::window_funnel_finalize(FunctionContext* ctx, const St return doris_udf::IntVal(val); } +// Refer to AggregateFunctionRetention.h in https://github.com/ClickHouse/ClickHouse.git +struct RetentionState { + static constexpr size_t max_events = 32; + std::bitset<max_events> events; + + RetentionState() {} + + void add(int event) { events.set(event); } + + void merge(RetentionState* other) { events |= other->events; } + + BooleanVal* getRetentionData() { + static BooleanVal data_to[max_events]; + int current_offset = 0; + + const bool first_flag = events.test(0); + data_to[current_offset] = first_flag; + ++current_offset; + + for (size_t i = 1; i < events.size(); ++i) { + data_to[current_offset] = (first_flag && events.test(i)); + ++current_offset; + } + return data_to; + } + + int64_t serizlized_size() { return sizeof(events); } + + void serialize(uint8_t* buf) { + memcpy(buf, &events, sizeof(events)); Review Comment: will do. -- 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