* Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
#pragma once
#include <cstdint>
class RowData;
class StateDataViewStore;
template <typename N>
class NamespaceAggsHandleFunctionBase {
public:
explicit NamespaceAggsHandleFunctionBase(int32_t accumulatorArity) : accumulatorArity_(accumulatorArity)
{
}
virtual ~NamespaceAggsHandleFunctionBase() = default;
virtual void open(StateDataViewStore* store) = 0;
virtual void setAccumulators(N namespace_val, RowData* accumulators) = 0;
virtual void accumulate(RowData* input_row) = 0;
virtual void retract(RowData* input_row) = 0;
virtual void merge(N namespace_val, RowData* other_acc) = 0;
virtual RowData* createAccumulators() = 0;
virtual RowData* getAccumulators() = 0;
virtual void cleanup(N namespace_val) = 0;
virtual void close() = 0;
protected:
int32_t accumulatorArity_;
};