```
DROP TABLE IF EXISTS foo;

CREATE TABLE foo (timestamp DateTime, x UInt64)
ENGINE = MergeTree PARTITION BY toYYYYMMDD(timestamp)
ORDER BY (timestamp);

INSERT INTO foo (timestamp, x) SELECT toDateTime('2020-01-01 00:05:00'), number from system.numbers_mt LIMIT 100;

SELECT count() FROM system.mutations; -- ok

ALTER TABLE foo UPDATE x = 1 WHERE x = (SELECT x from foo WHERE x = 1);

SELECT count() FROM system.mutations; -- stuck

```
{
    for (auto & it : fuse_map)
    {
        if (it.second.canBeFused())
        {
            for (auto & func: it.second.sums)
                replaceWithSumCount(it.first, *func);
            for (auto & func: it.second.avgs)
                replaceWithSumCount(it.first, *func);
            for (auto & func: it.second.counts)
                replaceWithSumCount(it.first, *func);
        }
    }
}
bool hasArrayJoin(const ASTPtr & ast)
{
    if (const ASTFunction * function = ast->as<ASTFunction>())
        if (function->name == "arrayJoin")
            return true;
    for (const auto & child : ast->children)
        if (!child->as<ASTSelectQuery>() && hasArrayJoin(child))
            return true;
    return false;
}
void renameDuplicatedColumns(const ASTSelectQuery * select_query)