2019-12-26 18:17:05 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-06-05 17:29:40 +00:00
|
|
|
#include <Parsers/IAST_fwd.h>
|
2019-12-26 18:17:05 +00:00
|
|
|
#include <Storages/ColumnsDescription.h>
|
|
|
|
#include <Storages/ConstraintsDescription.h>
|
2020-06-05 17:29:40 +00:00
|
|
|
#include <Storages/IndicesDescription.h>
|
|
|
|
#include <Storages/KeyDescription.h>
|
|
|
|
#include <Storages/TTLDescription.h>
|
|
|
|
#include <Storages/SelectQueryDescription.h>
|
|
|
|
|
2019-12-26 18:17:05 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2019-12-27 15:01:41 +00:00
|
|
|
/// Structure represent table metadata stored in memory.
|
|
|
|
/// Only one storage engine support all fields -- MergeTree.
|
|
|
|
/// Complete table AST can be recreated from this struct.
|
2019-12-26 18:17:05 +00:00
|
|
|
struct StorageInMemoryMetadata
|
|
|
|
{
|
2019-12-27 15:01:41 +00:00
|
|
|
/// Columns of table with their names, types,
|
|
|
|
/// defaults, comments, etc. All table engines have columns.
|
2019-12-26 18:17:05 +00:00
|
|
|
ColumnsDescription columns;
|
2019-12-27 15:01:41 +00:00
|
|
|
/// Table indices. Currently supported for MergeTree only.
|
2020-06-01 12:11:23 +00:00
|
|
|
IndicesDescription secondary_indices;
|
2019-12-27 15:01:41 +00:00
|
|
|
/// Table constraints. Currently supported for MergeTree only.
|
2019-12-26 18:17:05 +00:00
|
|
|
ConstraintsDescription constraints;
|
2019-12-27 15:01:41 +00:00
|
|
|
/// PARTITION BY expression. Currently supported for MergeTree only.
|
2020-06-05 17:29:40 +00:00
|
|
|
KeyDescription partition_key;
|
|
|
|
/// PRIMARY KEY expression. If absent, than equal to order_by_ast.
|
|
|
|
KeyDescription primary_key;
|
2019-12-27 15:01:41 +00:00
|
|
|
/// ORDER BY expression. Required field for all MergeTree tables
|
|
|
|
/// even in old syntax MergeTree(partition_key, order_by, ...)
|
2020-06-05 17:29:40 +00:00
|
|
|
KeyDescription sorting_key;
|
2019-12-27 15:01:41 +00:00
|
|
|
/// SAMPLE BY expression. Supported for MergeTree only.
|
2020-06-05 17:29:40 +00:00
|
|
|
KeyDescription sampling_key;
|
|
|
|
/// Separate ttl expressions for columns
|
|
|
|
TTLColumnsDescription column_ttls_by_name;
|
|
|
|
/// TTL expressions for table (Move and Rows)
|
|
|
|
TTLTableDescription table_ttl;
|
2019-12-27 15:01:41 +00:00
|
|
|
/// SETTINGS expression. Supported for MergeTree, Buffer and Kafka.
|
2020-06-05 17:29:40 +00:00
|
|
|
ASTPtr settings_changes;
|
|
|
|
/// SELECT QUERY. Supported for MaterializedView and View (have to support LiveView).
|
|
|
|
SelectQueryDescription select;
|
2020-02-14 13:17:50 +00:00
|
|
|
|
|
|
|
StorageInMemoryMetadata() = default;
|
2020-06-01 12:11:23 +00:00
|
|
|
StorageInMemoryMetadata(const ColumnsDescription & columns_, const IndicesDescription & secondary_indices_, const ConstraintsDescription & constraints_);
|
2019-12-26 18:17:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|