ClickHouse/src/Storages/ConstraintsDescription.h

36 lines
848 B
C++
Raw Normal View History

#pragma once
#include <Parsers/ASTConstraintDeclaration.h>
#include <Interpreters/ExpressionActions.h>
namespace DB
{
2019-05-19 05:27:00 +00:00
using ConstraintsExpressions = std::vector<ExpressionActionsPtr>;
struct ConstraintsDescription
{
2021-01-03 15:02:00 +00:00
enum class ConstraintType {
CHECK,
ASSUME,
};
2020-05-12 11:47:59 +00:00
std::vector<ASTPtr> constraints;
ConstraintsDescription() = default;
bool empty() const { return constraints.empty(); }
String toString() const;
static ConstraintsDescription parse(const String & str);
2019-05-19 05:27:00 +00:00
2021-01-03 15:02:00 +00:00
ASTs filterConstraints(ConstraintType type) const;
ConstraintsExpressions getExpressionsToCheck(const Context & context, const NamesAndTypesList & source_columns_) const;
2020-06-05 17:29:40 +00:00
ConstraintsDescription(const ConstraintsDescription & other);
ConstraintsDescription & operator=(const ConstraintsDescription & other);
};
}