diff --git a/src/Interpreters/ComparisonGraph.cpp b/src/Interpreters/ComparisonGraph.cpp index 42ab659c649..8a316a4109c 100644 --- a/src/Interpreters/ComparisonGraph.cpp +++ b/src/Interpreters/ComparisonGraph.cpp @@ -38,7 +38,8 @@ ComparisonGraph::ComparisonGraph(const std::vector & atomic_formulas) { if (atomic_formulas.empty()) return; - static const std::unordered_map relation_to_enum = { + static const std::unordered_map relation_to_enum = + { {"equals", Edge::Type::EQUAL}, {"less", Edge::Type::LESS}, {"lessOrEquals", Edge::Type::LESS_OR_EQUAL}, @@ -50,14 +51,16 @@ ComparisonGraph::ComparisonGraph(const std::vector & atomic_formulas) const auto atom = ComparisonGraph::normalizeAtom(atom_raw); const auto bad_term = std::numeric_limits::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()); if (it != std::end(asts_graph.ast_hash_to_component)) { if (!std::any_of( std::cbegin(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() && constraint_ast->getColumnName() == ast->getColumnName(); })) diff --git a/src/Interpreters/TreeCNFConverter.cpp b/src/Interpreters/TreeCNFConverter.cpp index b41939789a6..649e043b15f 100644 --- a/src/Interpreters/TreeCNFConverter.cpp +++ b/src/Interpreters/TreeCNFConverter.cpp @@ -83,7 +83,7 @@ void findOrs(ASTPtr & node, std::vector> & ors) if (func && func->name == "or") ors.push_back(node); - if (func) + if (func && (func->name == "and" || func->name == "not")) { for (auto & child : func->arguments->children) findOrs(child, ors);