The query

```
SELECT (1, 2) IN ((-9223372036854775808, (256, 10)), (3, 4), ((((((10 IN (NULL, 1048577, 1.)) IN (inf, NULL, NULL)) IN (((7 IN (-1, 2, 3, 1025, 1025)) IN (NULL, 1023 IN (inf, 1048576, (7, 100, 1024, 3)), NULL, 100.0000991821289)) IN (256, 65537), -9223372036854775808, 1048575)) IN (-2, NULL, 10 IN (NULL, 10, -2, 1.000100016593933))) IN (10 IN (NULL, 10, -2, 1.000100016593933), 1048577, 0.)) IN (65536, ((-2, 9223372036854775807 IN (-2, 10, 1025, 1., -1), 1025, 1., -1), 100, 4, 1025), NULL), 6), (7, 8), (1024, 6))
SETTINGS max_temporary_columns = 4
```

Triggers logical error exception.
set_element_types = left_tuple_type->getElements();
    for (auto & element_type : set_element_types)
        if (const auto * low_cardinality_type = typeid_cast<const DataTypeLowCardinality *>(element_type.get()))
            element_type = low_cardinality_type->getDictionaryType();
    auto set_key = PreparedSetKey::forLiteral(*right_arg, set_element_types);
    if (prepared_sets.count(set_key))
        return prepared_sets.at(set_key); 
    Block block;
    const auto & right_arg_func = std::dynamic_pointer_cast<ASTFunction>(right_arg);
    if (right_arg_func && (right_arg_func->name == "tuple" || right_arg_func->name == "array"))
        block = createBlockForSet(left_arg_type, right_arg_func, set_element_types, context);
    else
        block = createBlockForSet(left_arg_type, right_arg, set_element_types, context);
    SetPtr set = std::make_shared<Set>(size_limits, create_ordered_set, context.getSettingsRef().transform_null_in);
    set->setHeader(block.cloneEmpty());
    set->insertFromBlock(block);
    set->finishInsert();
    prepared_sets[set_key] = set;
    return set;
}
ScopeStack::ScopeStack(const ExpressionActionsPtr & actions, const Context & context_)
    : context(context_)
{
    stack.emplace_back();
    stack.back().actions = actions;
    const Block & sample_block = actions->getSampleBlock();
    for (size_t i = 0, size = sample_block.columns(); i < size; ++i)
        stack.back().new_columns.insert(sample_block.getByPosition(i).name);
}
void ScopeStack::pushLevel(const NamesAndTypesList & input_columns)