1#pragma once
2
3#include <Storages/ColumnsDescription.h>
4#include <Storages/IndicesDescription.h>
5#include <Storages/ConstraintsDescription.h>
6#include <Parsers/IAST_fwd.h>
7
8namespace DB
9{
10
11/// Structure represent table metadata stored in memory.
12/// Only one storage engine support all fields -- MergeTree.
13/// Complete table AST can be recreated from this struct.
14struct StorageInMemoryMetadata
15{
16 /// Columns of table with their names, types,
17 /// defaults, comments, etc. All table engines have columns.
18 ColumnsDescription columns;
19 /// Table indices. Currently supported for MergeTree only.
20 IndicesDescription indices;
21 /// Table constraints. Currently supported for MergeTree only.
22 ConstraintsDescription constraints;
23 /// PARTITION BY expression. Currently supported for MergeTree only.
24 ASTPtr partition_by_ast = nullptr;
25 /// ORDER BY expression. Required field for all MergeTree tables
26 /// even in old syntax MergeTree(partition_key, order_by, ...)
27 ASTPtr order_by_ast = nullptr;
28 /// PRIMARY KEY expression. If absent, than equal to order_by_ast.
29 ASTPtr primary_key_ast = nullptr;
30 /// TTL expression for whole table. Supported for MergeTree only.
31 ASTPtr ttl_for_table_ast = nullptr;
32 /// SAMPLE BY expression. Supported for MergeTree only.
33 ASTPtr sample_by_ast = nullptr;
34 /// SETTINGS expression. Supported for MergeTree, Buffer and Kafka.
35 ASTPtr settings_ast = nullptr;
36};
37
38}
39