mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-02 04:22:03 +00:00
fix
This commit is contained in:
parent
8e4dc3aa25
commit
24499fc31a
@ -38,7 +38,8 @@ ComparisonGraph::ComparisonGraph(const std::vector<ASTPtr> & atomic_formulas)
|
|||||||
{
|
{
|
||||||
if (atomic_formulas.empty())
|
if (atomic_formulas.empty())
|
||||||
return;
|
return;
|
||||||
static const std::unordered_map<std::string, Edge::Type> relation_to_enum = {
|
static const std::unordered_map<std::string, Edge::Type> relation_to_enum =
|
||||||
|
{
|
||||||
{"equals", Edge::Type::EQUAL},
|
{"equals", Edge::Type::EQUAL},
|
||||||
{"less", Edge::Type::LESS},
|
{"less", Edge::Type::LESS},
|
||||||
{"lessOrEquals", Edge::Type::LESS_OR_EQUAL},
|
{"lessOrEquals", Edge::Type::LESS_OR_EQUAL},
|
||||||
@ -50,14 +51,16 @@ ComparisonGraph::ComparisonGraph(const std::vector<ASTPtr> & atomic_formulas)
|
|||||||
const auto atom = ComparisonGraph::normalizeAtom(atom_raw);
|
const auto atom = ComparisonGraph::normalizeAtom(atom_raw);
|
||||||
|
|
||||||
const auto bad_term = std::numeric_limits<std::size_t>::max();
|
const auto bad_term = std::numeric_limits<std::size_t>::max();
|
||||||
auto get_index = [](const ASTPtr & ast, Graph & asts_graph) -> std::size_t {
|
auto get_index = [](const ASTPtr & ast, Graph & asts_graph) -> std::size_t
|
||||||
|
{
|
||||||
const auto it = asts_graph.ast_hash_to_component.find(ast->getTreeHash());
|
const auto it = asts_graph.ast_hash_to_component.find(ast->getTreeHash());
|
||||||
if (it != std::end(asts_graph.ast_hash_to_component))
|
if (it != std::end(asts_graph.ast_hash_to_component))
|
||||||
{
|
{
|
||||||
if (!std::any_of(
|
if (!std::any_of(
|
||||||
std::cbegin(asts_graph.vertices[it->second].asts),
|
std::cbegin(asts_graph.vertices[it->second].asts),
|
||||||
std::cend(asts_graph.vertices[it->second].asts),
|
std::cend(asts_graph.vertices[it->second].asts),
|
||||||
[ast](const ASTPtr & constraint_ast) {
|
[ast](const ASTPtr & constraint_ast)
|
||||||
|
{
|
||||||
return constraint_ast->getTreeHash() == ast->getTreeHash()
|
return constraint_ast->getTreeHash() == ast->getTreeHash()
|
||||||
&& constraint_ast->getColumnName() == ast->getColumnName();
|
&& constraint_ast->getColumnName() == ast->getColumnName();
|
||||||
}))
|
}))
|
||||||
|
@ -83,7 +83,7 @@ void findOrs(ASTPtr & node, std::vector<std::reference_wrapper<ASTPtr>> & ors)
|
|||||||
if (func && func->name == "or")
|
if (func && func->name == "or")
|
||||||
ors.push_back(node);
|
ors.push_back(node);
|
||||||
|
|
||||||
if (func)
|
if (func && (func->name == "and" || func->name == "not"))
|
||||||
{
|
{
|
||||||
for (auto & child : func->arguments->children)
|
for (auto & child : func->arguments->children)
|
||||||
findOrs(child, ors);
|
findOrs(child, ors);
|
||||||
|
Loading…
Reference in New Issue
Block a user