Files
scylladb/cql3/functions/user_aggregate.hh
Michał Jadwiszczak 29ad5a08a8 implement keyspace_element interface
This patch implements `data_dictionary::keyspace_element` interfece
in: `keyspace_metadata`, `user_type_impl`, `user_function`,
`user_aggregate` and schema.
2022-12-10 12:34:09 +01:00

56 lines
1.8 KiB
C++

/*
* Copyright (C) 2021-present ScyllaDB
*/
/*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#pragma once
#include "abstract_function.hh"
#include "scalar_function.hh"
#include "aggregate_function.hh"
#include "data_dictionary/keyspace_element.hh"
namespace cql3 {
namespace functions {
class user_aggregate : public abstract_function, public aggregate_function, public data_dictionary::keyspace_element {
bytes_opt _initcond;
::shared_ptr<scalar_function> _sfunc;
::shared_ptr<scalar_function> _reducefunc;
::shared_ptr<scalar_function> _finalfunc;
public:
user_aggregate(function_name fname, bytes_opt initcond, ::shared_ptr<scalar_function> sfunc, ::shared_ptr<scalar_function> reducefunc, ::shared_ptr<scalar_function> finalfunc);
virtual std::unique_ptr<aggregate_function::aggregate> new_aggregate() override;
virtual ::shared_ptr<aggregate_function> reducible_aggregate_function() override;
virtual bool is_pure() const override;
virtual bool is_native() const override;
virtual bool is_aggregate() const override;
virtual bool is_reducible() const override;
virtual bool requires_thread() const override;
bool has_finalfunc() const;
virtual sstring keypace_name() const override { return name().keyspace; }
virtual sstring element_name() const override { return name().name; }
virtual sstring element_type() const override { return "aggregate"; }
virtual std::ostream& describe(std::ostream& os) const override;
const scalar_function& sfunc() const {
return *_sfunc;
}
const scalar_function& reducefunc() const {
return *_reducefunc;
}
const scalar_function& finalfunc() const {
return *_finalfunc;
}
const bytes_opt& initcond() const {
return _initcond;
}
};
}
}