1515#pragma once
1616
1717#include " column/column.h"
18+ #include " exprs/agg/aggregate.h"
1819#ifdef __x86_64__
1920#include < immintrin.h>
2021#elif defined(__ARM_NEON) && defined(__aarch64__)
@@ -108,7 +109,7 @@ struct AggNonNullPred {
108109// For this case, the serialized output type is non-nullable, because only the state of input needs to be serialized.
109110// If all the rows are NULL or `AggNullPred` returns true, we will return NULL.
110111// The State must be NullableAggregateFunctionState
111- template <typename NestedFuncPtr , typename State, bool IsWindowFunc, bool IgnoreNull = true ,
112+ template <typename NestedAggregateFunctionPtr , typename State, bool IsWindowFunc, bool IgnoreNull = true ,
112113 IsAggNullPred<typename State::NestedState> AggNullPred = AggNonNullPred<typename State::NestedState>>
113114class NullableAggregateFunctionBase : public AggregateFunctionStateHelper <State> {
114115 using NestedState = typename State::NestedState;
@@ -117,7 +118,8 @@ class NullableAggregateFunctionBase : public AggregateFunctionStateHelper<State>
117118public:
118119 bool is_exception_safe () const override { return nested_function->is_exception_safe (); }
119120
120- explicit NullableAggregateFunctionBase (NestedFuncPtr nested_function_, AggNullPred null_pred = AggNullPred())
121+ explicit NullableAggregateFunctionBase (NestedAggregateFunctionPtr nested_function_,
122+ AggNullPred null_pred = AggNullPred())
121123 : nested_function(std::move(nested_function_)), null_pred(std::move(null_pred)) {}
122124 // as array_agg is not nullable, so it needn't create() here.
123125
@@ -311,17 +313,19 @@ class NullableAggregateFunctionBase : public AggregateFunctionStateHelper<State>
311313 }
312314
313315protected:
314- NestedFuncPtr nested_function;
316+ NestedAggregateFunctionPtr nested_function;
315317 AggNullPred null_pred;
316318};
317319
318- template <typename NestedFuncPtr , typename State, bool IsWindowFunc, bool IgnoreNull = true ,
320+ template <typename NestedAggregateFunctionPtr , typename State, bool IsWindowFunc, bool IgnoreNull = true ,
319321 IsAggNullPred<typename State::NestedState> AggNullPred = AggNonNullPred<typename State::NestedState>>
320322class NullableAggregateFunctionUnary final
321- : public NullableAggregateFunctionBase<NestedFuncPtr, State, IsWindowFunc, IgnoreNull, AggNullPred> {
323+ : public NullableAggregateFunctionBase<NestedAggregateFunctionPtr, State, IsWindowFunc, IgnoreNull,
324+ AggNullPred> {
322325public:
323- explicit NullableAggregateFunctionUnary (const NestedFuncPtr& nested_function, AggNullPred null_pred = AggNullPred())
324- : NullableAggregateFunctionBase<NestedFuncPtr, State, IsWindowFunc, IgnoreNull, AggNullPred>(
326+ explicit NullableAggregateFunctionUnary (const NestedAggregateFunctionPtr& nested_function,
327+ AggNullPred null_pred = AggNullPred())
328+ : NullableAggregateFunctionBase<NestedAggregateFunctionPtr, State, IsWindowFunc, IgnoreNull, AggNullPred>(
325329 nested_function, std::move(null_pred)) {}
326330
327331 // NOTE: In stream MV, need handle input row by row, so need support single update.
@@ -948,14 +952,15 @@ class NullableAggregateFunctionUnary final
948952 }
949953};
950954
951- template <typename NestedFuncPtr, typename State,
955+ template <typename State,
952956 IsAggNullPred<typename State::NestedState> AggNullPredType = AggNonNullPred<typename State::NestedState>>
953957class NullableAggregateFunctionVariadic final
954- : public NullableAggregateFunctionBase<NestedFuncPtr , State, false , true , AggNullPredType> {
958+ : public NullableAggregateFunctionBase<AggregateFunctionPtr , State, false , true , AggNullPredType> {
955959public:
956- NullableAggregateFunctionVariadic (NestedFuncPtr nested_function, AggNullPredType null_pred = AggNullPredType())
957- : NullableAggregateFunctionBase<NestedFuncPtr, State, false , true , AggNullPredType>(
958- std::move (nested_function), std::move(null_pred)) {}
960+ NullableAggregateFunctionVariadic (AggregateFunctionPtr nested_function,
961+ AggNullPredType null_pred = AggNullPredType())
962+ : NullableAggregateFunctionBase<AggregateFunctionPtr, State, false , true , AggNullPredType>(
963+ nested_function, std::move(null_pred)) {}
959964
960965 void update (FunctionContext* ctx, const Column** columns, AggDataPtr __restrict state,
961966 size_t row_num) const override {
0 commit comments