mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-14 18:32:29 +00:00
6fbb9f5e87
Example: ```sql EXPLAIN TABLE OVERRIDE mysql('127.0.0.1:3306', 'db', 'table', 'user', 'pw') PARTITION BY tuple(toYYYYMM(created), id % 8) ``` Validations done: * check that storage overrides do not reference unknown or nullable columns * check that default specifier is not modified for columns
39 lines
895 B
C++
39 lines
895 B
C++
#pragma once
|
|
|
|
#include <Common/assert_cast.h>
|
|
#include <Core/Names.h>
|
|
#include <Core/NamesAndTypes.h>
|
|
#include <Parsers/ASTTableOverrides.h>
|
|
|
|
namespace DB
|
|
{
|
|
|
|
struct StorageInMemoryMetadata;
|
|
|
|
using NameToTypeMap = std::map<String, DataTypePtr>;
|
|
|
|
struct TableOverrideAnalyzer
|
|
{
|
|
struct Result
|
|
{
|
|
NameToTypeMap existing_types;
|
|
NamesAndTypes order_by_columns;
|
|
NamesAndTypes primary_key_columns;
|
|
NamesAndTypes partition_by_columns;
|
|
NamesAndTypes sample_by_columns;
|
|
NamesAndTypes ttl_columns;
|
|
NamesAndTypes added_columns;
|
|
NamesAndTypes modified_columns;
|
|
|
|
void appendTo(WriteBuffer &);
|
|
};
|
|
|
|
ASTTableOverride * override;
|
|
|
|
explicit TableOverrideAnalyzer(ASTPtr ast) : override(assert_cast<ASTTableOverride *>(ast.get())) { }
|
|
|
|
void analyze(const StorageInMemoryMetadata & metadata, Result & result) const;
|
|
};
|
|
|
|
}
|