Files
scylladb/db/functions/stateless_aggregate_function.hh
Avi Kivity 0ae22a09d4 LICENSE: Update to version 1.1
Updated terms of non-commercial use (must be a never-customer).
2026-04-12 19:46:33 +03:00

36 lines
1.0 KiB
C++

// Copyright (C) 2023-present ScyllaDB
// SPDX-License-Identifier: (LicenseRef-ScyllaDB-Source-Available-1.1 and Apache-2.0)
#pragma once
#include "scalar_function.hh"
#include "function_name.hh"
#include <optional>
namespace db::functions {
struct stateless_aggregate_function final {
function_name name;
std::optional<sstring> column_name_override; // if unset, column name is synthesized from name and argument names
data_type state_type;
data_type result_type;
std::vector<data_type> argument_types;
bytes_opt initial_state;
// aggregates another input
// signature: (state_type, argument_types...) -> state_type
shared_ptr<scalar_function> aggregation_function;
// converts the state type to a result
// signature: (state_type) -> result_type
shared_ptr<scalar_function> state_to_result_function;
// optional: reduces states computed in parallel
// signature: (state_type, state_type) -> state_type
shared_ptr<scalar_function> state_reduction_function;
};
}