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.
{
                if (!tuple_type)
                    tuple_type = std::make_shared<DataTypeTuple>(types);
                function_result = extractValueFromNode(elem, *tuple_type, context);
                if (function_result.getType() != Field::Types::Tuple)
                    throw Exception("Invalid type of set. Expected tuple, got " + String(function_result.getTypeName()),
                                    ErrorCodes::INCORRECT_ELEMENT_OF_SET);
                tuple = &function_result.get<Tuple>();
            }
            auto * literal = elem->as<ASTLiteral>();
            if (literal)
            {
                 if (literal->value.getType() != Field::Types::Tuple)
                    throw Exception("Invalid type in set. Expected tuple, got "
                        + String(literal->value.getTypeName()), ErrorCodes::INCORRECT_ELEMENT_OF_SET);
                tuple = &literal->value.get<Tuple>();
            }
            size_t tuple_size = tuple ? tuple->size() : func->arguments->children.size();
            if (tuple_size != num_columns)
                throw Exception("Incorrect size of tuple in set: " + toString(tuple_size) + " instead of " + toString(num_columns),
                    ErrorCodes::INCORRECT_ELEMENT_OF_SET);
            if (tuple_values.empty())
                tuple_values.resize(tuple_size);
            size_t i = 0;
            for (; i < tuple_size; ++i)
            {
                Field value = tuple ? (*tuple)[i]
                                    : extractValueFromNode(func->arguments->children[i], *types[i], context);
                
                if (value.isNull() && !context.getSettings().transform_null_in)