2019-12-26 18:17:05 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Storages/ColumnsDescription.h>
|
|
|
|
#include <Storages/IndicesDescription.h>
|
|
|
|
#include <Storages/ConstraintsDescription.h>
|
|
|
|
#include <Parsers/IAST_fwd.h>
|
|
|
|
|
|
|
|
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.
|
2019-12-26 18:17:05 +00:00
|
|
|
IndicesDescription 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.
|
|
|
|
ASTPtr partition_by_ast = nullptr;
|
|
|
|
/// ORDER BY expression. Required field for all MergeTree tables
|
|
|
|
/// even in old syntax MergeTree(partition_key, order_by, ...)
|
2019-12-27 14:46:11 +00:00
|
|
|
ASTPtr order_by_ast = nullptr;
|
2019-12-27 15:01:41 +00:00
|
|
|
/// PRIMARY KEY expression. If absent, than equal to order_by_ast.
|
2019-12-27 14:46:11 +00:00
|
|
|
ASTPtr primary_key_ast = nullptr;
|
2019-12-27 15:01:41 +00:00
|
|
|
/// TTL expression for whole table. Supported for MergeTree only.
|
2019-12-27 14:46:11 +00:00
|
|
|
ASTPtr ttl_for_table_ast = nullptr;
|
2019-12-27 15:01:41 +00:00
|
|
|
/// SAMPLE BY expression. Supported for MergeTree only.
|
|
|
|
ASTPtr sample_by_ast = nullptr;
|
|
|
|
/// SETTINGS expression. Supported for MergeTree, Buffer and Kafka.
|
2019-12-27 14:36:59 +00:00
|
|
|
ASTPtr settings_ast = nullptr;
|
2020-01-29 17:44:16 +00:00
|
|
|
/// SELECT QUERY. Supported for MaterializedView only.
|
|
|
|
ASTPtr select = nullptr;
|
2019-12-26 18:17:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|