Files
scylladb/cql3/statements/create_index_statement.hh
Avi Kivity 5937b1fa23 treewide: remove empty comments in top-of-files
After fcb8d040 ("treewide: use Software Package Data Exchange
(SPDX) license identifiers"), many dual-licensed files were
left with empty comments on top. Remove them to avoid visual
noise.

Closes #10562
2022-05-13 07:11:58 +02:00

72 lines
2.6 KiB
C++

/*
* Copyright (C) 2015-present ScyllaDB
*
* Modified by ScyllaDB
*/
/*
* SPDX-License-Identifier: (AGPL-3.0-or-later and Apache-2.0)
*/
#pragma once
#include "schema_altering_statement.hh"
#include "index_target.hh"
#include "schema_fwd.hh"
#include <seastar/core/shared_ptr.hh>
#include <unordered_map>
#include <utility>
#include <vector>
#include <set>
namespace cql3 {
class query_processor;
class index_name;
namespace statements {
class index_prop_defs;
/** A <code>CREATE INDEX</code> statement parsed from a CQL query. */
class create_index_statement : public schema_altering_statement {
const sstring _index_name;
const std::vector<::shared_ptr<index_target::raw>> _raw_targets;
const ::shared_ptr<index_prop_defs> _properties;
const bool _if_not_exists;
cql_stats* _cql_stats = nullptr;
public:
create_index_statement(cf_name name, ::shared_ptr<index_name> index_name,
std::vector<::shared_ptr<index_target::raw>> raw_targets,
::shared_ptr<index_prop_defs> properties, bool if_not_exists);
future<> check_access(query_processor& qp, const service::client_state& state) const override;
void validate(query_processor&, const service::client_state& state) const override;
future<std::pair<::shared_ptr<cql_transport::event::schema_change>, std::vector<mutation>>> prepare_schema_mutations(query_processor& qp, api::timestamp_type) const override;
virtual std::unique_ptr<prepared_statement> prepare(data_dictionary::database db, cql_stats& stats) override;
private:
void validate_for_local_index(const schema& schema) const;
void validate_for_frozen_collection(const index_target& target) const;
void validate_not_full_index(const index_target& target) const;
void validate_is_values_index_if_target_column_not_collection(const column_definition* cd,
const index_target& target) const;
void validate_target_column_is_map_if_index_involves_keys(bool is_map, const index_target& target) const;
void validate_targets_for_multi_column_index(std::vector<::shared_ptr<index_target>> targets) const;
static index_metadata make_index_metadata(const std::vector<::shared_ptr<index_target>>& targets,
const sstring& name,
index_metadata_kind kind,
const index_options_map& options);
std::vector<::shared_ptr<index_target>> validate_while_executing(query_processor& qp) const;
schema_ptr build_index_schema(query_processor& qp) const;
};
}
}