OR to IN rewrite issue in functions

This commit is contained in:
chenxing.xc 2018-07-17 14:27:28 +08:00 committed by alexey-milovidov
parent 6d8d59bd1b
commit f6000b304c

View File

@ -357,11 +357,10 @@ void LogicalExpressionsOptimizer::fixBrokenOrExpressions()
for (auto & parent : parents)
{
parent->children.push_back(operands[0]);
auto first_erased = std::remove_if(parent->children.begin(), parent->children.end(),
[or_function](const ASTPtr & ptr) { return ptr.get() == or_function; });
parent->children.erase(first_erased, parent->children.end());
// The order of children matters if or is children of some function, e.g. minus
std::replace_if(parent->children.begin(), parent->children.end(),
[or_function](const ASTPtr & ptr) { return ptr.get() == or_function; },
operands[0] );
}
/// If the OR node was the root of the WHERE, PREWHERE, or HAVING expression, then update this root.