提交 42ed5f89 编写于 作者: A Alexey Milovidov

dbms: fixed error with IN and limits [#METR-9748].

上级 a7edba50
......@@ -518,7 +518,18 @@ void ExpressionAnalyzer::makeSet(ASTFunction * node, const Block & sample_block)
{
/// Исполняем подзапрос, превращаем результат в множество, и кладём это множество на место подзапроса.
ASTSet * ast_set = new ASTSet(arg->getColumnName());
InterpreterSelectQuery interpreter(arg->children[0], context, QueryProcessingStage::Complete, subquery_depth + 1);
/** Для подзапроса в секции IN не действуют ограничения на максимальный размер результата.
* Так как результат этого поздапроса - ещё не результат всего запроса.
* Вместо этого работают ограничения max_rows_in_set, max_bytes_in_set, set_overflow_mode.
*/
Context subquery_context = context;
Settings subquery_settings = context.getSettings();
subquery_settings.limits.max_result_rows = 0;
subquery_settings.limits.max_result_bytes = 0;
subquery_context.setSettings(subquery_settings);
InterpreterSelectQuery interpreter(arg->children[0], subquery_context, QueryProcessingStage::Complete, subquery_depth + 1);
ast_set->set = new Set(settings.limits);
ast_set->set->create(interpreter.execute());
arg = ast_set;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册