/* * Copyright (C) 2016-present ScyllaDB * * SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0 */ #pragma once #include "cql3/statements/schema_altering_statement.hh" #include "cql3/statements/cf_properties.hh" #include "cql3/cf_name.hh" #include "cql3/expr/expression.hh" #include #include #include namespace cql3 { class query_processor; class relation; namespace selection { class raw_selector; } // namespace selection namespace statements { /** A CREATE MATERIALIZED VIEW parsed from a CQL query statement. */ class create_view_statement : public schema_altering_statement { private: mutable cf_name _base_name; std::vector<::shared_ptr> _select_clause; expr::expression _where_clause; std::vector<::shared_ptr> _partition_keys; std::vector<::shared_ptr> _clustering_keys; cf_properties _properties; bool _if_not_exists; public: create_view_statement( cf_name view_name, cf_name base_name, std::vector<::shared_ptr> select_clause, expr::expression where_clause, std::vector<::shared_ptr> partition_keys, std::vector<::shared_ptr> clustering_keys, bool if_not_exists); std::pair prepare_view(data_dictionary::database db) const; auto& properties() { return _properties; } // Functions we need to override to subclass schema_altering_statement virtual future<> check_access(query_processor& qp, const service::client_state& state) const override; future, utils::chunked_vector, cql3::cql_warnings_vec>> prepare_schema_mutations(query_processor& qp, const query_options& options, api::timestamp_type) const override; virtual std::unique_ptr prepare(data_dictionary::database db, cql_stats& stats) override; // FIXME: continue here. See create_table_statement.hh and CreateViewStatement.java private: ::shared_ptr created_event() const; }; } }