Fixed half of bad code [#CLICKHOUSE-2]

This commit is contained in:
Alexey Milovidov 2018-03-16 09:39:32 +03:00
parent dc4a9be6fa
commit cf6112fd37

View File

@ -1505,13 +1505,16 @@ void ExpressionAnalyzer::makeSetsForIndexImpl(const ASTPtr & node, const Block &
if (func && functionIsInOperator(func->name))
{
const IAST & args = *func->arguments;
if (storage && storage->mayBenefitFromIndexForIn(args.children.at(0)))
{
const ASTPtr & arg = args.children.at(1);
if (!prepared_sets.count(arg.get())) /// Not already prepared.
{
if (typeid_cast<ASTSubquery *>(arg.get()) || typeid_cast<ASTIdentifier *>(arg.get()))
{
if (settings.use_index_for_in_with_subqueries && storage->mayBenefitFromIndexForIn(args.children.at(0)))
if (settings.use_index_for_in_with_subqueries)
tryMakeSetFromSubquery(arg);
}
else
@ -1525,6 +1528,7 @@ void ExpressionAnalyzer::makeSetsForIndexImpl(const ASTPtr & node, const Block &
}
}
}
}
}