#pragma once #include #include #include #include namespace DB { using ConstraintsExpressions = std::vector; struct ConstraintsDescription { public: ConstraintsDescription() { update(); } bool empty() const { return constraints.empty(); } String toString() const; static ConstraintsDescription parse(const String & str); enum class ConstraintType { CHECK = 1, ASSUME = 2, ALWAYS_TRUE = CHECK | ASSUME, ALL = CHECK | ASSUME, }; ASTs filterConstraints(ConstraintType selection) const; const std::vector & getConstraints() const; void updateConstraints(const std::vector & constraints); const std::vector> & getConstraintData() const; std::vector getAtomicConstraintData() const; const ComparisonGraph & getGraph() const; ConstraintsExpressions getExpressions(ContextPtr context, const NamesAndTypesList & source_columns_) const; ConstraintsDescription(const ConstraintsDescription & other); ConstraintsDescription & operator=(const ConstraintsDescription & other); private: std::vector> buildConstraintData() const; std::unique_ptr buildGraph() const; void update(); std::vector constraints; std::vector> cnf_constraints; std::unique_ptr graph; }; }